2024-04-30 11:35 AM
When configuring UART on the board, according to https://wiki.st.com/stm32mcu/wiki/Getting_started_with_UART the program can be flashed once. When trying to flash again the system reports:
Target no device found
Error in initializing ST-LINK device.
Reason: No device found on target.
This happens even when just the configuration is set, no data transmitted and MS_USART_UARTx_Init() is commented out. The error occurs with every UART. It does not disappear when deleting the UART configuration in the IOC editor and regenerate the code without any references to UART. With BOOT0 set to high, reconnecting to ST-Link and flashing another program without configured UART the board behaves normally again. Commenting out HAL_Init() prevents this error, but I strongly assume that leads to other problems. This only happens to the Bluepill board, testing the same configuration with an STM32F407VGT6 (STM32F4-Discovery and an STM32F401CEU6 (Blackpill) stay inconspicuously.
Any ideas how to circumvent this behavior?
Solved! Go to Solution.
2024-04-30 12:13 PM
@waclawek.jan wrote:it's unlikely that you have an STM32 on a bluepill board.
Indeed.
@hbr See this thread for a current example of the tale of woe resulting from the bluepill fakery:
2024-04-30 12:06 PM - edited 2024-04-30 12:06 PM
Make sure your program does not set AFIO_MAPR.SWJ_CFG in a way which disables debugging.
Also make sure you don't set system clock outside its operational envelope.
Also, it's unlikely that you have an STM32 on a bluepill board.
JW
2024-04-30 12:11 PM - edited 2024-04-30 12:12 PM
How do you have pins PA14, PA13 setup ?
Debug -> No Debug (then the problem is here)
or
Debug -> Serial Wire
2024-04-30 12:13 PM
@waclawek.jan wrote:it's unlikely that you have an STM32 on a bluepill board.
Indeed.
@hbr See this thread for a current example of the tale of woe resulting from the bluepill fakery:
2024-05-01 04:28 AM
After some investigations I tend to the assumption that this is not an original STM32F103C8T6. The information the board gave are not as clearly as in other posts stated, but in sum it looks like this is a fake. I.e. the JDEC data is valid for STMicroelectronics. The test program found in Your linked forum "Bluepill Diagnostics" current version 1.6.40 shows only on anomaly, the DBGMCU_IDCODE is zero. It should be different for ST MCUs. STMCubeProgrammer, successor to the st-link tool, shows zeros where they should not be.
The only strange thing is that there were no problems before. Each project with them worked perfectly.
2024-05-01 04:30 AM
Thanks for Your answer. The problem seems to be another one. It is very unlikely that I used a real ST MCU but a fake one. This was the first topic I run into trouble with the clone.
2024-05-01 04:57 AM
Thanks for the link. I made some further investigations with other tools and it strongly looks like I got a clone. In my reply to @waclawek.jan I gave some more details.
The clones are getting better, my ST-Link V2 has a clone inside, an APM32F103CBT6. STLinkUpgrade v3.15.6 updated the firmware without complains.
This was the first project where some trouble occurred, so I didn't think it could be a fake.