Assistance/guidelines for porting STM32duino to the STM32F3

Limited support for STM32F3 based boards, e.f STM Discovery and Nucleo line
Post Reply
Posts: 2
Joined: Thu Sep 07, 2017 6:15 pm

Assistance/guidelines for porting STM32duino to the STM32F3

Post by pramilo » Thu Sep 07, 2017 6:28 pm


I read Roger's post here mentioning his availability to give some pointers on how to go about porting the stm32duino libraries to the STM32F3.

I have a good amount of experience in low level ATMEL programming and have also done work on low level libraries for the Teensyduino and written some specific code from scratch for the Teensy 3.2 (Cortex M4) (for example, continuous ADC sampling via interrupts, tweaking the USART libraries to oeprate in one wire half duplex mode, write TSI code from scratch...).

I am beginning a new project where we're designing a board around the STM32F303RET6 to break out of the limitations of the Teensy 3.2.
We intend to port the code we already have compiling with the Teensyduino lib to some other library and the stm32 seems to be the one that might provide the best compatibility.
Having read quite a bit about developing from scratch for these processors, I could either do it from scratch and just implement what I need (CDC USB, UARTs and digitalWrite/analogRead) or I might as well take a swing at porting the stm32duino libraries. (probably the same work or maybe even less and I make a contribution to the community).

Since I am a newly registered user I can't PM Roger, so I am posting here hoping someone can give the right pointers.

Thank you very much,
Last edited by pramilo on Mon Sep 11, 2017 6:16 pm, edited 1 time in total.

User avatar
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia

Re: Assistance/guidelines for porting STM32duino to the STM32F3

Post by RogerClark » Thu Sep 07, 2017 9:00 pm

Now that STM have written their own core for the F3, I recommend you use that core.

The F3 in my repo was just put there for historical record, as it had been abandoned by its author.

Alternatively you could also use Koduino, by Avid De, which is a core he developed specificly for the F3
you could make a version using Danieleff's STM32GENERIC core. But I dont know if he has already done a variant for the F3

Posts: 1746
Joined: Mon Apr 27, 2015 12:12 pm

Re: Assistance/guidelines for porting STM32duino to the STM32F3

Post by victor_pv » Fri Sep 08, 2017 12:58 am

The F3 is nearly identical to the F1 except with a Cortex-M4, so if you want to work on updating the F3 core for any function that doesn't work, it should be doable using the F1 as reference as just changing only what's different, that shouldn't be much.

I did a brain transplant in a bluepill from an F1 to an F303CCT6 and tested a basic blinking sketch. I mostly did it for the heck of it, since there are a few threads about that transplant being successful (and even replacing the F1 with an F4). So the F3 core works for the basic.

Still if you are not familir with libmaple, Roger's advice to use STM's own core is likely the best. That core is based on STM's HAL, so anything you learn about the HAL you can still apply later if you decide to just use the HAL and drop Arduino.

There is a couple of forum members that work for STM and are very helpful if you have trouble or questions about that core or the STM32 in general, and I'm sure STM will be happy more people uses their core.

Posts: 2
Joined: Thu Sep 07, 2017 6:15 pm

Re: Assistance/guidelines for porting STM32duino to the STM32F3

Post by pramilo » Mon Sep 11, 2017 11:42 am

Thank you very much for all your excellent replies.

I'm trying to stay clear of the STM HAL as I've read two not so great things about it: (1) it's incomplete in many cases or the documentation is lacking compared to the actual implemented functionality, (2) adds significant overhead. It's also known for being sometimes buggy.
Also, we're running some time sensitive tasks on the processor and even though the processor is extremely fast, I'd prefer to stay away from the HAL.

I'm more than happy to read through the processor datasheet and look at registers, etc.

For now, I'll try Koduino as I suppose it follows the same Arduino principles. I find this great to get you started as you can use the built functions and then tweak or (re)write the pieces where you need a different or new behavior.
I know Koduino is lacking the USB slave device code (ie to implement a Virtual COMM port). If I do get around to building it, I'll come back to post it.

Once again thank you all for your advice.

Best Regards,

Post Reply