Skip to main content
Miguel XRay
Associate
April 18, 2020
Question

STM32CubeMX bug preventing to use the LED output (PC13) on STM32F103/BluePill + bug in SVD file for STM32F103

  • April 18, 2020
  • 5 replies
  • 2091 views

I am using a Chinese low-cost "Blue Pill" board with an STM32F103C8T6, and developping in EmBitz IDE using init code generated by STM32CubeMX. On this board, the PC13 output is connected to an LED, but the code generated by STM32CubeMX will not allow to control this output.

The root cause is that the init code sets the ASOE bit (b8) in BKP_RTCCR, which reserves the PC13 pin for the "Alarm or second output".

This is an error, because in STM32CubeMX I correctly set PC13 as an output GPIO and no error was indicated.

Once you know it, the solution is easy, just adding the following line after the standard initialization:

BKP->RTCCR &= ~BKP_RTCCR_ASOE;

This bug was specially difficult to find, because there is also a bug in the file STM32F103.svd:

In the file, RTCCR is at offset 0x28 and CR at offset 0x2C, but according to the reference manual RTCCR is at offset 0x2C and CR at offset 0x30.

As a result, the faulty bug is RTCCR is displayed as a non-existing bit in CR.

So please fix these two bugs, it should not be too difficult!

This topic has been closed for replies.

5 replies

Nesrine.JLASSI
Visitor II
May 11, 2020

Hello @MJ.2ulier​ 

Could you please share your ioc file to check the issue.

Best regards,

Nesrine

Miguel XRay
Associate
May 12, 2020
Ludovic Feltz
Associate II
October 5, 2020

Hello @Nesrine.JLASSI​ ,

I have the same issue with STM32MP157A-DK1 board and can't find a way to fix it... (Can't control LD6 led, but works for others: LD5, LD7, LD8)

Is there a workaround for this issue?

I'm new to STM developments (coming from Arduino/Raspberry developments) so it's very hard to figure it out by myself...

Thanks!

Ludovic Feltz.

Tesla DeLorean
Guru
October 5, 2020

Perhaps best not to hijack an unrelated thread. The F1 series, and most of the STM32 MCU series, have PC13 in the low power domain.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ludovic Feltz
Associate II
October 5, 2020

Thanks for your quick reply, it's the closer thread from my problem. Do you suggest that i post a new question about my issue?