cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 HardFault immediately after debugging starts.

AMelk.1
Associate II

Hi. I have some strange error when debugging code at my STM32F103C8T6 BluePill board.

When I start debugging, everything seems fine (the debugger connects to the target, erases it, downloads firmware, and verifies it successfully). But instead of jumping to the int main() function body - the debug is in the HardFault handler. Also, my second stm32f103c8t6 board has exactly the same issue.

0693W00000aIDJ1QAO.png0693W00000aIDJBQA4.png 

Another strange thing - I have a third stm32f103c8t6 BluePill board that works correctly. Debug starts from int main and everything is fine.

Is it a problem with my two boards? Or did I miss something important?

I've already fully erased all 3 boards in STM32CubeProg. But nothing changed.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Thank you, @Community member​, for your question in the community!

Regardless of your programme, which you have not shown here and which can also cause the hard fault - we have the discussion about the Blue Pill here regularly. The probability that there is an genuine STM32F103C8 on the board is close to zero. This has also been discussed at length on Hackaday, and they have also created a diagnostic program that should be able to detect such fakes.

If the diagnosis shows a counterfeit, it would be best to replace the fake STM32F103C8 with originals.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

Thank you, @Community member​, for your question in the community!

Regardless of your programme, which you have not shown here and which can also cause the hard fault - we have the discussion about the Blue Pill here regularly. The probability that there is an genuine STM32F103C8 on the board is close to zero. This has also been discussed at length on Hackaday, and they have also created a diagnostic program that should be able to detect such fakes.

If the diagnosis shows a counterfeit, it would be best to replace the fake STM32F103C8 with originals.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
AMelk.1
Associate II

Hi, Peter!

Thank you for your help. Will check my boards with this program. And I will come back with the results

I got it! Actually, the problem is as you say in the fake MCU. Not fully fake, but a different MCU model. On the bad BluePill, I have STM32F103C6xx instead of STM32F103C8xx. They differentiate in the Flash size (32kB and 64kB respectively).

So I`ve created a new CubeIDE project for STM32F103C6 MCU and everything is ok!

Thank you very much!

P.S.: This test script you shared with me helped to identify the problem. Since it's about 61KB in size, it just won't load on my bad stm32 (doesn't fit in its flash memory).