cancel
Showing results for 
Search instead for 
Did you mean: 

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

Miguel XRay
Associate II

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!

5 REPLIES 5

Hello @MJ.2ulier​ 

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

Best regards,

Nesrine

Miguel XRay
Associate II

Here it is!

Ludovic Feltz
Associate II

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.

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
Up vote any posts that you find helpful, it shows what's working..

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?