[DONE] Demo for STM32F401C Discovery board

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
trepidacious
Posts: 58
Joined: Mon Jan 21, 2013 3:36 pm
Been thanked: 1 time

[DONE] Demo for STM32F401C Discovery board

Post by trepidacious »

Hi All,

I've ported a simple demo to the F401C disco board, based on the 407 demos. This just blinks the 4 LEDs and sets up a USB serial shell. You will need to change the CHIBIOS path in the Makefile to wherever you have ChibiOS trunk.

The board.h changes needed were to change the MCU define to STM32F401xx, rename PB11 to make it clear it is unusable, to rename PE2, 4 and 5 to show they are connected to the LSM303DLHC, and to remove the GPIO ports that aren't present.

I also modified the mcuconf.h to produce an 84MHz system clock and remove settings for devices that aren't present.

Finally, I made a new .ld file for the 401xC

Other than this things seem to run very similarly - I think I've probably update everything needed, but I might well have missed something. Hopefully this will be helpful in adding an official demo! I would have ported the SPI and PWM stuff, but the MEMs sensor is a different model, so I'm not sure the driver would be compatible.
Attachments
ARMCM4-STM32F401C-DISCOVERY.zip
Archive of demo project.
(111.62 KiB) Downloaded 432 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Demo for STM32F401C Discovery board

Post by Giovanni »

Thanks, I'll add it.

Giovanni
User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: Demo for STM32F401C Discovery board

Post by lilvinz »

Some things to fix:
mcuconf.h:
* F401 doesn't have backup sram
* F401 doesn't have EXTI20 and 21
* F401 doesn't have timers 6, 7, 8 but has timer 10
* F401 has UART1, 2 and 6
hal:
* The exti driver doesn't recognize the missing lines 20 and 21 and fails to build
* The vector table lacks the last vector (0x190 - SPI4)
* F401 has SPI4 but in hal_lld.h its defined to FALSE

Thats what i have found so far.

@Giovanni do you have an idea if / when the hal will be fixed so i can reasonably decide if its worth tentatively fixing it myself.

Cheers,

Vinz
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Demo for STM32F401C Discovery board

Post by Giovanni »

Hi,

Added to the TODO list. I had no idea there were so many differences, the 401 support is very experimental.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Demo for STM32F401C Discovery board

Post by Giovanni »

Hi,

I made all fixes, could you confirm I didn't forget something?

Giovanni
User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: [DONE] Demo for STM32F401C Discovery board

Post by lilvinz »

Sorry for the late reply. I can't see where you added the missing vector 0x190 for SPI4.
I was looking at this commit:
https://github.com/ChibiOS/ChibiOS-RT/c ... a30ee19005

edit: disregard comment, i was looking at the wrong commit.
edit: this is the right one: https://github.com/ChibiOS/ChibiOS-RT/c ... ec7#diff-6
User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: [DONE] Demo for STM32F401C Discovery board

Post by lilvinz »

Hi,

there is one fix i missed:
The F401 doesn't have EXTI line 19 (ETH_WKUP_IQRn).
It has to be disabled in ext_lld_isr.c.

Thanks and regards,

Vinz
Post Reply