Page 2 of 3

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Tue Nov 01, 2016 5:20 am
by Chudik
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.

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Fri Nov 18, 2016 2:51 pm
by mobyfab
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.

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu Dec 01, 2016 6:39 pm
by omcdr
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

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu Apr 13, 2017 2:53 pm
by mobyfab
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.

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu Apr 13, 2017 7:57 pm
by omcdr
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.

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu Apr 27, 2017 7:36 pm
by mobyfab
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/

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu Apr 27, 2017 11:19 pm
by mobyfab
Generated an .exe for windows users that don't want to install python:

https://www.dropbox.com/s/6jlsojdmclz61 ... d.exe?dl=0

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu May 04, 2017 10:39 pm
by access777
Hello!
Could you say some words about how to use the exe script? A little manual or tutorial :)

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Mon May 08, 2017 3:04 pm
by mobyfab
See post above

You will get a .h file with all the gpio configuration and some defines to help use the I/Os.
Just include this file in your board.h after deleting the gpio config.

I use it here: https://github.com/fpoussin/MotoLink/tr ... ode/common

I added the script here: https://github.com/ChibiOS/ChibiOS-Cont ... ster/tools

Re: STM32 CubeMX to ChibiOS board file generator

Posted: Thu May 11, 2017 1:07 pm
by access777
Sorry to disturb you, but I cant use your exe correct. Please, help me
I have made the *.bat file in the my CUBE project folder
mx2board -g GPIO
pause
But I have an error messages with the all options. What options and how should I use?
Screenshot_1.png

Screenshot_2.png
Screenshot_2.png (6.04 KiB) Viewed 6815 times

UPD
AAAAA!!! I have no permissions to the GPIO folder!
My problem has not solved I have no any idea :(
Screenshot_3.png