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: 412
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 4 times

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: 56
Joined: Wed Aug 17, 2016 3:25 pm
Has thanked: 3 times
Been thanked: 3 times

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: 412
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 4 times

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: 56
Joined: Wed Aug 17, 2016 3:25 pm
Has thanked: 3 times
Been thanked: 3 times

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: 412
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 2 times
Been thanked: 4 times

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/

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

Re: STM32 CubeMX to ChibiOS board file generator

Postby mobyfab » Thu Apr 27, 2017 11:19 pm

Generated an .exe for windows users that don't want to install python:

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

access777
Posts: 8
Joined: Fri Apr 21, 2017 4:10 pm
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby access777 » Thu May 04, 2017 10:39 pm

Hello!
Could you say some words about how to use the exe script? A little manual or tutorial :)

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

Re: STM32 CubeMX to ChibiOS board file generator

Postby mobyfab » Mon May 08, 2017 3:04 pm

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

access777
Posts: 8
Joined: Fri Apr 21, 2017 4:10 pm
Has thanked: 2 times
Been thanked: 1 time

Re: STM32 CubeMX to ChibiOS board file generator

Postby access777 » Thu May 11, 2017 1:07 pm

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 204 times

UPD
AAAAA!!! I have no permissions to the GPIO folder!
My problem has not solved I have no any idea :(
Screenshot_3.png
Last edited by access777 on Thu May 11, 2017 3:07 pm, edited 1 time in total.


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 1 guest