Microsoft MakeCode

Creating Custom Board - Question About Pin Hardware Numbers?

Hi there. I am currently working on a project for a local company, the main premise of it being to get their custom board up and running on the MakeCode Maker simulator. However, I am a programming student with very little knowledge of the hardware itself.

When creating a custom board, the file config.ts is to be updated to include the pin names as well as the pin hardware numbers (ex. export const PIN_RCC1 = DAL.PA07 - the bolded being what this question is about). I’m sorry to bug the forum with something that may be a bit stupid, but what are the pin hardware numbers and how does one figure out what they are?

Thank you for any help you can give.

1 Like

Here’s the answer I posted in the micro:bit topic (I think the question was added to an existing thread on your behalf). I’m posting my reply here too. I’m also adding just a few details that weren’t covered there:

I haven’t done this sort of thing, but it looks like this guide is helpful:

I think the config.ts is a map of the symbolic pin names from the simulator to the actual hardware pin names.

I’m using an example from Here’s an example of how I think it fits together…There are several symbols that are used and the are in multiple files.

  1. D0 , A2 , and SDA are all symbols that are used when programming ( D0 is digital in/out 0. A2 is Analog in 2, etc.). Often a pin can do multiple functions — in this case a single pin does all three of these things, but is usually only used for one at a time. If I’m doing digital work, I’ll think of it as D0 . If I’m doing analog work, I’d think of it as A2 .
  2. In some places it’s important to be aware that this one thing serves all three purposes, so the name A2_D0_SDA is used too.
  3. The actual pin on the hardware isn’t named with any of these. It was selected by the people who made the processor (who didn’t know how the processor would be used and didn’t use names like D0 ). The hardware uses a name like PA08 .

The project’s pxt.json indicates it uses the samd processor, so that’s where the DAL part will come from. The dal.d.ts for the core---samd defines PA08 = 8 .

So, the story:

  1. Someone decided to make a board. They selected a samd processor and figured out which pins would be used for which functions (this is also related to what the particular processor can do). They may have identified that they’ll use “Pin 8” of “Port A” as a SDA , A2 , and D0 .
  2. The samd module already existed and had a variety of names defined to make it easy for basic hardware code to work with Port A Pin 8 via PA08 , but it doesn’t know that it’ll be used as D0 on this specific board.
  3. The board designer created a schematic and then a picture of what the board will look like for the simulator. That picture, boardhd.svg, includes a “label” on the place where the pin will connect (it’s invisible data in the .svg file). The person who made the picture picked a really descriptive name that explains all the pin can do: A2_D0_SDA . That’s a bit clunky for programmers who only think about one use at a time, like D0 .
  4. The boardhd.svg was uploaded to the board designer, which creates initial versions of config.ts and board.json.
  5. board.json and boardhd.svg are all about the simulator. board.json does two things: 1) It indicates the x,y coordinates for where A2_D0_SDA is in the SVG (so wires in the simulator will go to the right place in the drawing) and 2) Gives simpler, additional names for A2_D0_SDA , like D0 , ‘A2’, and SDA . (Ex: "D0": "A2_D0_SDA", ).
  6. config.ts is about the actual hardware. It explains how the names like D0 correspond to a real pin on the processor. There wasn’t enough detail to fill in hardware details in config.ts, so it’ll initially have incomplete parts, like export const PIN_D0 = DAL.?; . The ? needs to be filled in with the name of the actual hardware pin, so it’d need to be changed to: export const PIN_D0 = DAL.PA08; (Again, this is based on the initial choices when the board was designed…The designer decided to use Port A’s Pin 8 for the concept of D0 on their board)

A lot of that’s speculation…If anyone has any confirmation or correction it’d be appreciated.


  • DAL is an acronym for Device Abstraction Layer. I’m this is because the higher layer things in MakeCode are “abstract” and apply to lots of different devices. This is the layer that translates them to bare metal.
  • Maker supports a variety of cores: nRF52, samd, samd51, and stm32 See: . There’s a core--???? directory for each processor that includes a dal.d.ts with the mapping for the DAL object for that processor.