Trying to run example code of RT-STM32F401C-DISCOVERY on stm32f401ccu6 but can not succeed

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

Moderators: RoccoMarco, barthess

lschyi
Posts: 2
Joined: Sun Dec 22, 2019 4:54 am

Trying to run example code of RT-STM32F401C-DISCOVERY on stm32f401ccu6 but can not succeed

Postby lschyi » Sun Dec 22, 2019 3:34 pm

Hi all,

recently I got a new board called blackpill (a STM32F401CCU6 version, not the STM32F103). This board is interesting for it has a type c female socket on it and it also improves the way of entering the DFU mode. I checked the datasheet and I am pretty sure the pin definition of STM32F401CCU6 is the same as the STM32F401 Discovery board, which is using STM32F401VCT6.
However, I used the demo RT-STM32F401C-DISCOVERY, only change the LED pin and compiled, downloaded it into the blackpill, but the LED seems not to blink. May I ask are there any settings I need to change to make the example run on that blackpill? Any thoughts would be helpful, thank you.

The code I changed in the example is changing the LED pin with:

Code: Select all

static THD_FUNCTION(Thread1, arg) {

   (void)arg;
   chRegSetThreadName("blinker");
   while (true) {
      palSetPad(GPIOC, 13);
      chThdSleepMilliseconds(500);
      palClearPad(GPIOC, 13);
      chThdSleepMilliseconds(500);
   }
}


The Chibios I am using is ver17.6.3, compiled with arm-none-eabi-gcc-9.2.1 and downloaded via dfu-util. The download is succeeded for I can downloaded other bin files the vendor provided and the LED is blinking.

The vendor also provides the schematic file where I listed in the attachments. The blackpill uses a 25Mhz, 9PF high-speed oscillator and a 32.768K, 6PF low-speed oscillator. The vendor also provides an examples of PWM with an LED written with Keil.
Attachments
stm32f4x1_Templates.zip
(894.15 KiB) Downloaded 153 times
schematic.zip
(108.31 KiB) Downloaded 131 times

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Trying to run example code of RT-STM32F401C-DISCOVERY on stm32f401ccu6 but can not succeed

Postby Giovanni » Sun Dec 22, 2019 7:07 pm

Hi,

Check clock xtal frequencies, if different then you need to adjust settings in mcuconf.h. Also try to put a breakpoint in the crt0 entry point and see if it gets at least there.

Giovanni

lschyi
Posts: 2
Joined: Sun Dec 22, 2019 4:54 am

Re: Trying to run example code of RT-STM32F401C-DISCOVERY on stm32f401ccu6 but can not succeed

Postby lschyi » Mon Dec 23, 2019 1:23 am

Hi Giovanni,

thanks for your advise. After changing to the correct clock parameters in mcuconf.h and set the pin mode for the LED pad, it works nicely. Sorry for my stupidity for I did not know there is a default pin mode definition in board.h so that I only changed the LED pad without also set the mode. Thank you, wish you have a nice day.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 15 guests