I'm using the SD Card object to write sensor signals to. Although every once in a while I get an error and I have to stick the SD card in my computer and fix it. Is there a way the Propeller can preform this? For example:
where the IF errorNumber statement should light an LED to signify there is an error, then unmount partition, format it, and reboot. I've tried this yet it didn't work, it just kept rebooting. I know all the other code works fine.Code:PUB main | errorNumber, errorString Ser.start(31,30,0,115200) waitcnt(clkfreq * 3 + cnt) fat.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, { } _rtcdatpin, _rtcclkpin, _rtcbuslck) cog := cognew(Get_Data, @stack[0]) cognew(Display, @stack[150]) dira[9] := 1 outa[9] := 1 errorString := \code ' Returns the address of the error string or null. errorNumber := fat.partitionError ' Returns the error number or zero. if(errorNumber) ' Light a LED if an error occurs. outa[23] := 1 dira[23] := 1 fat.unmountPartition fat.formatPartition(0) reboot repeat ' Wait until reset or power down.
I basically want the Propeller to fix the SD card in case there is a power failure during a write command.
This is my first time using the SD card driver. Any help will be appreciated.



Reply With Quote




Bookmarks