cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot access STM32F103CBT6 again after downloading program created by latest CubeMX 6.10.0.

MNapi
Senior III

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.

 

 

 

12 REPLIES 12

Untitled.png

 

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.

Semer CHERNI
ST Employee

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 :

SemerCHERNI_0-1704809251554.png

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)

SemerCHERNI_1-1704811712250.png

  /** 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.

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.