2025-05-13 9:23 AM
Hi Support Team,
I am using the STM32F103RCT6 MCU in my design, I am facing one issue related to the software reset using "HAL_NVIC_SystemReset();" api is not working and the IDWG also not working after downloading the .hex file using the custom bootloader. However the other code works fine but when the software reset "HAL_NVIC_SystemReset()" is called the MCU hangs and the IWDG also not able to reset the MCU.
I have tried the same project downloading through ST-LINK V2 and the code works fine along with software reset and IWDG.
I am not able to find the cause of the software reset and IWDG not working after downloading the .hex file using the custom SPI bootloader.
I am 100 % sure there is no issue in writing the .hex contents into flash memory using the bootloader. I am using the same process from several months and it is working fine. Only the issue happening after adding software reset and IDWG in the code.
does the program download using ST-LINK V2 and STM32 CUBE IDE uses the .hex file or any other file is used like .elf is used while downloading program using ST-LINK V2?
I suspect some issue in the generation of the .hex file.
Please help find the issue.
Thanks and Regards,
Aadesh
2025-05-13 9:30 AM
Make sure you're not connecting NRST to a supply rail or push-pull driver, as this will keep it HIGH, and not able to pulse LOW to reset.
We are not familiar with your board design or the code you've loaded on it.
You'll have to check and debug your code if the functionality has stopped working recently.
>>I suspect some issue in the generation of the .hex file.
Convince me..
2025-05-13 10:29 AM - edited 2025-05-13 10:31 AM
Hello @Tesla DeLorean ,
As i have already mentioned, With the same instance of the STM32 CUBE IDE project,
1) Code works fine along with software reset and IWDG when downlaod using the ST-LINK V2
can you confirm if the .hex file is used while programming the device when i use ST-LINK V2 in STM32 Cube IDE?
2) When i use the .hex file generated and downlaod using the SPI bootloader, Only the software reset and IWDG reset dosen't work and after calling the software reset API the code hangs and the device does not reset using IWDG. however the other functionalities in the code work fine if the software reset api is not called.
I am not a expert in the STM32 CUBE IDE build settings, if the CUBE IDE uses .elf file to program the device then I think some issue in the generation of the .hex file or may be there is some option in build settings for .hex file which is restricting the software reset /IWDG reset.
I am writing all the .hex lines with data frame in the hex file at respective address, I am sure that the .hex file content is written properly into the flash using the bootloader and the other parts of the code works fine except the software reset and IWDG reset.
I don't see issue with the NRST connection as the software reset and IWDG reset works fine after downloading from the CUBE IDE using ST-LINK V2
Best Regards,
Aadesh
2025-05-13 10:48 AM
Check the memory mapping when the SPI Boot Loader is in-effect. ie mapped to the ROM, not the FLASH
Check BOOTx pin states
It is likely resetting into the ROM, rather than your code, in FLASH.
The SCB->VTOR will reset to ZERO when NRST is driven low/high, the BOOTx pins will determine what code is executed.
From a FLASH image perspective, do a CRC or Checksum of the entire code space, and check what's reported in your different modes of programming.