STM32 CubeMX to ChibiOS board file generator

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general.
User avatar
Chudik
Posts: 150
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 5 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby Chudik » Tue Nov 01, 2016 5:20 am

Asked my friend to run through Python on his computer,
Here what I noted:
- All pins shown as 'otype':None
Is it correct? I have outputs and inputs in my configuration.

Got "Missing Peripheral" messages
Missing Peripheral: ADC_IN1 at PA1
Missing Peripheral: GPXTI2 at PD2

while pins set
PA1 - {'otype': None, 'label': None, 'speed': None, 'signal': 'ADC_IN1', 'pupd': None}
PD2 - {'otype': None, 'label': 'INT [EXTI2]', 'speed': None, 'signal': 'GPXTI2', 'pupd': None}
respectively.

mobyfab
Posts: 405
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby mobyfab » Fri Nov 18, 2016 2:51 pm

Hi,

The current version of the script is here: https://gist.github.com/fpoussin/3317dc197ef0857294f0
I had to make some fixes because the CubeMX software changed its format.

Missing peripherals means that: it cannot find the peripheral definition, hence it does not know the correct pin mode/mux for it.
You'll have to look in the MCU datasheet for that.

otype should never be none.

omcdr
Posts: 44
Joined: Wed Aug 17, 2016 3:25 pm
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby omcdr » Thu Dec 01, 2016 6:39 pm

I got error, what does it mean ?

Code: Select all

Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1

mobyfab
Posts: 405
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby mobyfab » Thu Apr 13, 2017 2:53 pm

omcdr wrote:I got error, what does it mean ?

Code: Select all

Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1
Missing Peripheral: S_TIM2_CH2 at PA1


It means it cannot find the peripheral in PIN_FUNC_MAPPING_DEFAULT nor PIN_FUNC_MAPPING
You have to add it with the correct properties such as AF number which you'll find in the datasheet.

I am working on a version that does that automatically by reading the GPIO XML files from CubeMX.

omcdr
Posts: 44
Joined: Wed Aug 17, 2016 3:25 pm
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby omcdr » Thu Apr 13, 2017 7:57 pm

I am working on a version that does that automatically by reading the GPIO XML files from CubeMX


Great, we are waiting for next revision.

mobyfab
Posts: 405
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby mobyfab » Thu Apr 27, 2017 7:36 pm

It's done!

https://gist.github.com/fpoussin/3317dc197ef0857294f0

You will need the GPIO definition file from STM32CubeMX and the jinja2 python module. (use pip to install it)
I'll try to make an executable for windows users using py2exe.

Code: Select all

usage: mx2board.py [-h] [-g GPIO] [-b PROJECT] [-o OUTPUT]

Generate GPIO header file from STM32CubeMX file.

optional arguments:
  -h, --help            show this help message and exit
  -g GPIO, --gpio GPIO
  -b PROJECT, --project PROJECT
  -o OUTPUT, --output OUTPUT


GPIO XML files are located in the STM32CubeMX folder under /db/mcu/IP/


Return to “User Projects”

Who is online

Users browsing this forum: mobyfab, omcdr and 1 guest