How to adjust pinouts for new boards
Posted: Mon Aug 14, 2023 11:34 am
I am developing a new variant using STM32L052K6T6, there are no existing variants for L0 family so I concluded that I had to create my own. Copied over F103 variant_BLUEPILL_F103C6.cpp and variant_BLUEPILL_F103C6.h over and preparing to adapt it to my board. This is where the confusion settled in !
variant_BLUEPILL_F103C6.h:
What are these numbers 0,1,2 ? It is not surely PIN 0 on the chip as there is no PIN 0, so what does this mapping represent ?
Why these PAx ones are different ? What are they doing ?
I suppose these are setting alternate functions for those pins, but what are ALT1 / ALT2, how to set them for my board ?
variant_BLUEPILL_F103C6.cpp:
What is the intention here, this array is filled in the order pins are placed on the actual PCB, but I cannot tell the use for them. PB9 is the zeroth element of this array, so is that 0 matching the 0 in .h file ?
Is there a document I can read ? Or otherwise there are references to a "genpinmap" utility, but I couldn't find it, seems like it has been deprecated.
I appreciate if someone can offer me a starting point.
variant_BLUEPILL_F103C6.h:
Code: Select all
#define PB9 0
#define PB8 1
#define PB7 2
...
Code: Select all
#define PC14 18
#define PC15 19
#define PA0 PIN_A0
#define PA1 PIN_A1
#define PA2 PIN_A2
#define PA3 PIN_A3
Code: Select all
#define PB0_ALT1 (PB0 | ALT1)
#define PB0_ALT2 (PB0 | ALT2)
#define PB1_ALT1 (PB1 | ALT1)
variant_BLUEPILL_F103C6.cpp:
Code: Select all
const PinName digitalPin[] = {
/* USB connector on the top, MCU side */
/* Left Side */
PB_9, //D0
PB_8, //D1
PB_7, //D2
PB_6, //D3
Is there a document I can read ? Or otherwise there are references to a "genpinmap" utility, but I couldn't find it, seems like it has been deprecated.
I appreciate if someone can offer me a starting point.