Page 1 of 1

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

Posted: Sun Dec 22, 2019 3:34 pm
by lschyi
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.

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

Posted: Sun Dec 22, 2019 7:07 pm
by Giovanni
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

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

Posted: Mon Dec 23, 2019 1:23 am
by lschyi
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.