Hello Everyone,
I came across keil flash download failure issue because of the watchdog. The watchdog will reset the chip during the process of flash download. And the watchdog can be disabled by hardware reset.
There are two ways to program flash, one is click "download" button(Shortcut Key = F8), the other is click start/stop debug session button(Shortcut Key = Ctrl + F5). There is a "pre-reset" option in debug setting, it works well. Also I found the pre-download script function in Keil IDE. The following is the script I tried. There is a gpio pin used to do hardware reset.
FUNC void Setup (void) { // Hardware reset the chip to disable the watchdog _WDWORD(0x400866AC, 0x14); // Port D pin 11, GPIO, floating _WDWORD(0x400F6018, 1<<25); // GPIO port6, pin25, output _WDWORD(0x400F6218, 1<<25); // GPIO port6, pin25, output high level //_sleep_(4000); } Setup(); // Setup for Flash
Unfortunately, It failed. It seems that Keil IDE does not support this scenario.
Does anyone have any idea?
Thank you! Leo