Cannot flash RAK3172 using ST-LINK

Have you tried configuring the reset mode to Hardware Reset and MCU RST connected? (I am not sure if your ST LINK has that pin). TRST (pin3) seems not to work. I also tried testing it with my STM32WL DK here.

Thanks @cstratton. Yes, you are right. I fixed that error yesterday by manually erasing the whole memory sector by sector. From that I have been able to flash the MCU and verify the program successfully. That proves the MCU does works using UART boot mode. However, I’m trying to figure out how to debug the MCU using ST-Link which is totally different from UART boot mode.

Hi @carlrowan, my ST-Link-V2 was connected to RAK3172 with BOOT0 to GND, NRST connected, external 3.3V power supply with common ground, SWCLK and SWDIO connected. I tried all possible configurations on STM32CubeProgrammer as you have mentioned. All of them worked for WL55 SoC but nothing seems to work with RAK3172. I don’t think there is anything else I could do. Thank you so much for your help!

I am getting out of ideas here. Hmm. What IDE are you using? Does it support STLINK integration? If it does, can you try if you can debug there? I had experience before that I can connect my STLINK to the STM32CubeIDE but can’t connect to STM32CubeProgrammer.

Thank you! I tested the module using STM32CubeIDE and it does not find any target MCU. Could you please try to perform full chip erase for RAK3172 using UART boot mode? If it does not show up any errors, then that means my RAK modules have a problem. I did that with my WL55 SoC and it was done smoothly. Otherwise, I will purchase ST-Link V2 from digikey and test the module again.


d

Hi @hienvu ,

You can perform full erase on lower version of STM32CubeProgrammer. I also got failures at v2.9.0. I am coordinating it now with the R&D team.

Thank you for the help. I can perform full erase for RAK3172 via UART using lower version of STM32CubeProgrammer. Meanwhile, I tried with my new ST-Link-V2 from digikey using all combinations with similar configuration and software/firmware version as you did. It worked with my WL55 SoC but still doesn’t work for my two RAK3172 modules.

I tried again with 5-pin JTAG connected to a new RAK3172, and modified debug configuration in the IDE (confirmed external 3.3V power supply from WL55 DK), but I still get the same error. Anyway, thank you so much for the support!

Thank you so much @carlrowan ! The module will not work with ST-Link V2 without the reset circuit in this diagram. In short, to flash RAK3172 using ST-Link V2:

  • Boot0 must be connected to the ground.
  • NRST must be connected to the debugger (sometime it still works without this connection).
  • The reset circuit is critical.
  • Power, SWDIO, SWCLK are connected.

I also tested the module with ST-Link V3 in WL55 DK but it doesn’t work.

This is not required, SWD should be operational in either flash or system ROM (bootloader) mode. However, forcing it to system ROM mode can be a way to work around a program in flash (intentional or corruption) that disables the SWD

  • NRST must be connected to the debugger (sometime it still works without this connection).
  • The reset circuit is critical.

This is not required unless what is in flash would disable SWD. I’ve seen this happen somewhat randomly with a wide variety of STM32’s even when there’s no attempt to load a program that intentionally repurposes the SWD pins as GPIO (or UART or whatever). So it’s useful to know how to fix such a situation, but 95% of the time a flashing setup only needs ground, SWD, SWCLK, and a target voltage reference if the adapter is a real one that doesn’t make assumptions.

I also tested the module with ST-Link V3 in WL55 DK but it doesn’t work.

It will if the connections are made correctly

Anyway, glad you found something that worked for you, just pointing out that what you are experience are local quirks, not general needs.

It is good to hear it is working now @hienvu . Boot0 is internally pulled to ground so no need to do it. The reset is important if you select hardware_reset.

Yes, it was tricky though. Thank you all for the support!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.