# Creating Custom Board - Question About Pin Hardware Numbers?

**URL:** https://forum.makecode.com/t/creating-custom-board-question-about-pin-hardware-numbers/7984
**Category:** Maker
**Created:** [May 10, 2021, 3:50pm UTC](https://forum.makecode.com/t/creating-custom-board-question-about-pin-hardware-numbers/7984 "2021-05-10T15:50:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lnbent](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@lnbent](https://forum.makecode.com/u/lnbent)
#### Post date: [May 10, 2021, 3:50pm UTC](https://forum.makecode.com/t/creating-custom-board-question-about-pin-hardware-numbers/7984/1 "2021-05-10T15:50:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [May 17, 2021, 4:50am UTC](https://forum.makecode.com/t/creating-custom-board-question-about-pin-hardware-numbers/7984/2 "2021-05-17T04:50:48Z")

</div>

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: [https://www.hackster.io/wallarug/makecode-creating-custom-boards-92d933](https://www.hackster.io/wallarug/makecode-creating-custom-boards-92d933).

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 [https://github.com/microsoft/pxt-maker/blob/master/libs/adafruit-trinket-m](https://github.com/microsoft/pxt-maker/blob/master/libs/adafruit-trinket-m). 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`](https://github.com/microsoft/pxt-maker/blob/master/libs/core---samd/dal.d.ts) 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](https://maker.makecode.com/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.

**ADDITIONAL DETAILS** :

- DAL is an acronym for **D** evice **A** bstraction **L** ayer. 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: [https://github.com/microsoft/pxt-maker/tree/master/libs](https://github.com/microsoft/pxt-maker/tree/master/libs) . There’s a `core--????` directory for each processor that includes a `dal.d.ts` with the mapping for the `DAL` object for that processor.
