STM-32 Debugging Hint

If you are attempting to debug a project that you have imported from the STM32CubeIDE, be aware that the STM-32 code generator may include a function call that disables the SWD debug functionality, which not only prevents debugging, but also prevents the embeetle IDE from flashing new code to the STM-32 target using openocd.

For the STM-32F1 series, the file stm32f1xx_hal_msp.c may contain a function call to __HAL_AFIO_REMAP_SWJ_DISABLE() - if it does, just comment this line out, and debugging will once again be possible.

The embeetle example project “blue-pill” has this function call present, so you will want to comment out the SWJ_DISABLE function call if you intend to try debugging.

If you have already compiled and flashed that example project to your blue pill, you can use the STM32CubeProgrammer application to erase the STM-32 and start over.

Regards; N3SB

1 Like