2023-03-05 04:14 PM
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.
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.
Solved! Go to Solution.
2023-03-05 11:57 PM
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
2023-03-05 11:57 PM
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
2023-03-06 12:19 AM
Hi, Peter!
Thank you for your help. Will check my boards with this program. And I will come back with the results
2023-03-06 12:50 AM
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).