I am developing on a STM32F103RB platform. My application enables and uses the "hardware watchdog" feature of the processor. This feature is enabled by programming in the "option bytes" in the processor's FLASH memory. Once enabled in the "option bytes", the processor's watchdog timer is started, and the watchdog feature enabled at processor RESET. This happens BEFORE the first instruction is executed.
By default (from the factory) the "option bytes" are set to NOT enable the hardware watchdog feature, but my application requires the feature be enabled and rewrites the "option bytes" if they are not the desired value.
As a result, I can download my application once from the CrossWorks IDE and run it. After it has been run the IDE can no-longer download the the target successfully unless I first re-flash the "option bytes" to disable the hardware watchdog feature. I can only presume the watchdog timer is expiring mid-download, causing the processor to RESET.
The download process in the debugger should be changed so as to enable it to download successfully with the watchdog enabled (or it should temporarily disable the watchdog, perform the download, and restore the original settings.
Issues also exist when the debugger tries to VERIFY downloaded code when the read-protection is enabled.
As a work-around I tried to disable the HW watchdog by tweaking the required bit in the USER option byte (WDG_SW) from a java-script call invoked with the Loader Reset Script in the IDE. Aside from not being the ideal solution (it has significant side-effects) I was unable to make this work. (Ref: TargetInterface.pokeUint16() can't write to FLASH on STM32)
Please sign in to leave a comment.