2024-01-06 04:11 PM - edited 2024-01-06 04:15 PM
I created new program using latest CubeMX 6.10.0, I use Keil. I upload without any problems.
I use ST Link v3 connected to PA13 (SWDIO) , PA14 (SWCLK)
The program is running but when I try to connect again it says STM32 not found.
I cannot debug, I cannot download again.
There is no extra code, only plain code created by CubeMX, all pins are not enabled, nothing.
Still the same problem.
I connect pin BOOT0 to 3.3V and suddenly I can access the chip again and upload program.
When I use program created by older CubeMX, I do not have this problem.
Has anybody seen something like this ? There must be something with the code generated by latest CubeMX
I haven't check other chips I have noticed this only with STM32F103CBT6. Other might be affected too.
Solved! Go to Solution.
2024-01-07 05:21 PM - edited 2024-01-07 05:22 PM
this is how it looks like after uploading the code first time, the second time I cannot connect anymore.
Cube programmer says no STM32 target found.
Since we have
#include "stm32f1xx_hal.h"
I guess it might be the whole F1 family and maybe other too.
2024-01-09 06:49 AM
Hello
After analyzing the generated code, I found that the void HAL_MspInit(void) contains a call for a macro which set the GPIO debug pins according to the setting done in the CubeMX :
The screenshot shows the default stat which will make the CubeMX insert the following code in HAL_MspInit(void) which disable the SW debug
/** DISABLE: JTAG-DP Disabled and SW-DP Disabled
*/
__HAL_AFIO_REMAP_SWJ_DISABLE();
To be able to make it debug correctly, you need to explicitly set the Debug settings in CubeMX (Case of SW with ST-Link)
/** NOJTAG: JTAG-DP Disabled and SW-DP Enabled
*/
__HAL_AFIO_REMAP_SWJ_NOJTAG();
KR,
Semer.
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.
2024-01-10 04:26 PM
thanks it was indeed the problem, I checked, tested and all is working now.
previous CubeMX wasn't doing it.
some change and it makes you to scratch head and you do not know what is happening.