Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 7 months ago. This question has been closed. Reason: Unclear question
mbed crashing on deleted code
I've been trying to implement a watchdog timer into my code, used an implementation I found online and compiled my project. My device crashed as soon as the code started, so I assume there's a mistake somewhere. Deleted the code from my implementation and put it on my device, just make sure it wasn't a hardware issue and it crashes. It was working before.
I go to the revisions menu and it shows no changes from my last commit. I reverted to a previous version, ran it and it worked. I switched to the most recent version (which previously hadn't worked) and it ran fine.
If I add in the watchdog code, even if it isn't called, then nothing which the mbed compiler compiles will run until I revert my code in the revisions menu. The code can be 100% identical and contain no trace of the watchdog code I wrote, but it'll still crash until I revert.
#include "Watchdog.h" void Watchdog::feed(float s) { LPC_WDT->WDCLKSEL = 0x1; uint32_t clk = SystemCoreClock / 16; LPC_WDT->WDTC = s * (float)clk; LPC_WDT->WDMOD = 0x3; feed(); } void Watchdog::feed() { LPC_WDT->WDFEED = 0xAA; LPC_WDT->WDFEED = 0x55; }