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.
10 years, 6 months ago.
how to clear infinite program with no access to filesystem?
I was playing around with some of the demo's and made the temperature hello world print out it's value to a file, but i left it in an infinite loop, now i can't get access to the filesystem to delete the program.
connecting to the serial output i can see the program continues to run after resetting and power cycling
DO NOT RUN THIS!!!!!
#include "mbed.h" // Read temperature from LM75BD I2C i2c(p28, p27); LocalFileSystem local("local"); const int addr = 0x90; int main() { char cmd[2]; while(1) { cmd[0] = 0x01; cmd[1] = 0x00; i2c.write(addr, cmd, 2); wait(0.5); cmd[0] = 0x00; i2c.write(addr, cmd, 1); i2c.read(addr, cmd, 2); float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0); printf("Temp = %.2f\n", tmp); FILE *fp = fopen("/local/testFile.csv", "w"); fprintf(fp, "temp, %.2f\n", tmp); fclose(fp); } }
i realize i should have set a fixed number of iterations, or had some type of interrupt/check value, silly mistake, but is there no way to clear the program now? windows 8 sees the mbed for a moment, then says theres no flash storage available to mount,
1 Answer
10 years, 6 months ago.
As soon as it starts writing it will unmount the drive to prevent collisions between writes on the PC side and the mbed side, which results in the drive immediatly disapearing and you not being able to stop it.
But don't fear, there is a solution :P.
Hold the reset. Plug in the USB of your mbed. Keep holding the reset. Upload a new binary. And release the reset button :). Maybe press it again to actually perform the reset, not 100% sure if it will check for new binary on rising or falling edge of the reset button. Now it should work again.