Various random stuff

I like that idea, I have been changing the pins to fit my application

I don’t think that reworking all the symbols is the right way (it is a lot of work for little gain). However, I like the idea of customized part symbols a lot and we have most of the tools already. I reckon, most of us are using the STM32Cube tool to configure the MCU peripheries. It has a handy reporting tool, which outputs a TAB separated text file. A little python script could turn this output into a CSV file for KiPart. With a simple batch file, any changes in the Cube tool could be easily moved into our KiCAD project, where all pins would be organized by function.
Just take a look at an example report:

Configuration trigger_m4_qfp100
STM32CubeMX 4.23.0
Date 12/25/2017
MCU STM32F407VETx

PERIPHERALS MODES FUNCTIONS PINS
ADC1 IN3 ADC1_IN3 PA3
ADC1 IN4 ADC1_IN4 PA4
ETH RMII ETH_CRS_DV PA7
ETH RMII ETH_MDC PC1
ETH RMII ETH_MDIO PA2
ETH RMII ETH_REF_CLK PA1
ETH RMII ETH_RXD0 PC4
ETH RMII ETH_RXD1 PC5
ETH RMII ETH_TXD0 PB12
ETH RMII ETH_TXD1 PB13
ETH RMII ETH_TX_EN PB11
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 NE1 FSMC_NE1 PD7
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 LCD Interface FSMC_NOE PD4
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 LCD Interface FSMC_NWE PD5
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 A16 FSMC_A16 PD11
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D0 PD14
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D1 PD15
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D2 PD0
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D3 PD1
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D4 PE7
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D5 PE8
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D6 PE9
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D7 PE10
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D8 PE11
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D9 PE12
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D10 PE13
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D11 PE14
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D12 PE15
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D13 PD8
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D14 PD9
FSMC:NOR Flash/PSRAM/SRAM/ROM/LCD 1 16 bits FSMC_D15 PD10
RCC Crystal/Ceramic Resonator RCC_OSC_IN PH0-OSC_IN
RCC Crystal/Ceramic Resonator RCC_OSC_OUT PH1-OSC_OUT
SDIO SD 4 bits Wide bus SDIO_CK PC12
SDIO SD 4 bits Wide bus SDIO_CMD PD2
SDIO SD 4 bits Wide bus SDIO_D0 PC8
SDIO SD 4 bits Wide bus SDIO_D1 PC9
SDIO SD 4 bits Wide bus SDIO_D2 PC10
SDIO SD 4 bits Wide bus SDIO_D3 PC11
SPI1 Full-Duplex Master SPI1_MISO PA6
SPI1 Full-Duplex Master SPI1_MOSI PB5
SPI1 Full-Duplex Master SPI1_SCK PA5
SYS Serial Wire SYS_JTCK-SWCLK PA14
SYS Serial Wire SYS_JTMS-SWDIO PA13
SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick
TIM4 Encoder Mode TIM4_CH1 PD12
TIM4 Encoder Mode TIM4_CH2 PD13
USART1 Asynchronous USART1_RX PA10
USART1 Asynchronous USART1_TX PA9
USB_OTG_FS Device_Only USB_OTG_FS_DM PA11
USB_OTG_FS Device_Only USB_OTG_FS_DP PA12

Pin Nb PINs FUNCTIONs LABELs
2 PE3 GPIO_Input Button 1
3 PE4 GPIO_Input Button 2
4 PE5 GPIO_Input Button 3
5 PE6 GPIO_Output Status LED
12 PH0-OSC_IN RCC_OSC_IN
13 PH1-OSC_OUT RCC_OSC_OUT
16 PC1 ETH_MDC
24 PA1 ETH_REF_CLK
25 PA2 ETH_MDIO
26 PA3 ADC1_IN3
29 PA4 ADC1_IN4
30 PA5 SPI1_SCK
31 PA6 SPI1_MISO
32 PA7 ETH_CRS_DV
33 PC4 ETH_RXD0
34 PC5 ETH_RXD1
38 PE7 FSMC_D4
39 PE8 FSMC_D5
40 PE9 FSMC_D6
41 PE10 FSMC_D7
42 PE11 FSMC_D8
43 PE12 FSMC_D9
44 PE13 FSMC_D10
45 PE14 FSMC_D11
46 PE15 FSMC_D12
48 PB11 ETH_TX_EN
51 PB12 ETH_TXD0
52 PB13 ETH_TXD1
55 PD8 FSMC_D13
56 PD9 FSMC_D14
57 PD10 FSMC_D15
58 PD11 FSMC_A16
59 PD12 TIM4_CH1
60 PD13 TIM4_CH2
61 PD14 FSMC_D0
62 PD15 FSMC_D1
65 PC8 SDIO_D0
66 PC9 SDIO_D1
68 PA9 USART1_TX
69 PA10 USART1_RX
70 PA11 USB_OTG_FS_DM
71 PA12 USB_OTG_FS_DP
72 PA13 SYS_JTMS-SWDIO
76 PA14 SYS_JTCK-SWCLK
78 PC10 SDIO_D2
79 PC11 SDIO_D3
80 PC12 SDIO_CK
81 PD0 FSMC_D2
82 PD1 FSMC_D3
83 PD2 SDIO_CMD
85 PD4 FSMC_NOE
86 PD5 FSMC_NWE
88 PD7 FSMC_NE1
91 PB5 SPI1_MOSI

2 Likes

It is very little work since the symbol generation is scripted, just a few lines of code needed changing.

The official libraries are really for users who don’t have the skills or motivation to create their own, so really need to be general purpose. If a user is going to the effort to create their own symbols, then the content of the official libraries is moot.

I like the idea of tying up with external config tools, but the output lacks a lot of information required to generate the symbol. I think I will create a “customise” script which can take a custom spec and create a symbol using the standard symbol as a template.

1 Like

It seems KiPart already has support for STM32Cube. However, it only parses by ports only. I would prefer to do it by function instead.

Here is what it created from my sample project.

1 Like

I played around then I wrote a little python script. This is the output now using KiPart. I kinda like it.

stm32parse.py (4.1 KB)

2 Likes

Latest version will be here:
https://github.com/csatti/STM32Parse

1 Like

You may see about getting it listed here:

2 Likes

First, I will test it with a real project. Let’s see how useful is this approach.

OK. Keep that link in mind. Until Kicad has a proper plug in manager this is probably our best option to share useful scripts.

1 Like