autosportlabs / RaceCapture-Pro-firmware-mk1

A repo for maintaining MK1 firmware separate of MK2 and future products.
GNU General Public License v3.0
1 stars 0 forks source link

MK1 fails to write file on first write attemt on SD card #11

Open stieg opened 8 years ago

stieg commented 8 years ago

For some strange reason MK1 is refusing to write to SD card on first attempt after power cycle. On following attempts, it works just fine.

stieg commented 8 years ago

Turns out that it doesn't happen when there are no log files on the card. Only happens after you powercycle the unit and already have log files on there. Then it will fail its first write attempt. But subsequent ones are fine. Also seems to happen if you try to write without the SD card in the unit, then return the SD card and try writing again. The plot thickens...

stieg commented 8 years ago

Log output:

*** Start! ***
CAN controller reset fail. mode=7
CAN init fail
Start OBD2 task
timebase/logging/telemetry sample rate: 50/25/25
lua: Initializing...
lua: Loading lua script (len = 21): SUCCESS!
lua: memory usage: 5KB
BT: Probing baud 115200
BT: Provision fail
BT: Probing baud 9600
Logging started
fileWriter.c: Start
fileWriter.c: Opening log file
fileWriter.c: Opened rc_11.log
fileWriter.c: Remounting FS due to write error.
fileWriter.c: Opening log file
fileWriter.c: Opened rc_11.log
fileWriter.c: Remounting FS due to write error.
fileWriter.c: Opening log file
fileWriter.c: Opened rc_11.log
fileWriter.c: Remounting FS due to write error.
fileWriter.c: Opening log file
fileWriter.c: Opened rc_11.log
fileWriter.c: Remounting FS due to write error.
fileWriter.c: Opening log file
toga94m commented 8 years ago

Works fine on my MK1, SD card has many files. No red light, no error in log window:

RaceCapture/Pro > viewLog Starting logging mode. Hit "q" to exit * Start! * CAN init win Start OBD2 task timebase/logging/telemetry sample rate: 50/25/25 lua: Initializing... lua: Loading lua script (len = 21): SUCCESS! lua: memory usage: 5KB BT: Probing baud 115200 BT: Provision win BT: Init complete Logging started fileWriter.c: Start fileWriter.c: Opening log file fileWriter.c: Opened rc_179.log Logging stopped

toga94m commented 8 years ago

But - unplugged BT dongle and CAN dongle, repeat, LEDs indicate logging going on but USB/console session hangs after this : *** Start! *** CAN controller reset fail. mode=0 CAN init fail Start OBD2 task timebase/logging/telemetry sample rate: 50/25/25 lua: Initializing... lua: Loading lua script (len = 21): SUCCESS! lua: memory usage: 5KB BT: Probing baud 115200 BT: Provision fail BT: Probing baud 9600 BT: Provision fail BT: Probing baud 230400 BT: Provision fail BT: Failed to provision module. Assuming already connected. Logging started fileWriter.c: Start fileWriter.c: Opening log file So maybe there's an error that I can't see because the console crashed too. Power & console via USB to laptop.

(next tests) plugged CAN dongle back in, same result. Plugged bluetooth dongle in, still crashes. Did not do this before. In fact it's a hard crash that resets after a few seconds, but the RCP isn't detected properly by windows. powercycle (usb power) recovers a running MK1. Nothing wierd on SD card, all these buttonpresses produced sanely timestamped logfiles.

stieg commented 8 years ago

So after further evaluation this is reproducible only with certain SD cards. Could not reproduce it with certain cards like SanDisk microSD 32GB. So there is a timing issue here somewhere in the code. I'm going to punt this from 2.8.7 for MK1 since this is not severe enough to hold a release.

toga94m commented 8 years ago

Hate to say, but the only SD card I've been using in MK1 for 1+ year now has the crash feature. This was with the unit powered via USB to a laptop. Tonight I powered with USB & AC adapter, and got one startup and log; subsequent powercycles refused to log (top-right LED steady until watchdog crash/reboot). Unplugging GPS mouse allows datalogging (obviously with no timestamp on the SD file). Plug GPS in and restore power, lower-right LED blinks about 3-4Hz, and log button tries (top-right steady for a few seconds) then all go out, crash & burn.

So, maybe related to filecreation having a valid timestamp from GPS?

brentpicasso commented 8 years ago

Understood about the SD card working previously . What brand is it? Can you try one from Sandisk?

Can you identify what older firmware version works with your card?

Brent Picasso Autosport Labs Technology for Race and Street On Feb 3, 2016 7:47 PM, "toga94m" notifications@github.com wrote:

Hate to say, but the only SD card I've been using in MK1 for 1+ year now has the crash feature. This was with the unit powered via USB to a laptop. Tonight I powered with USB & AC adapter, and got one startup and log; subsequent powercycles refused to log (top-right LED steady until watchdog crash/reboot). Unplugging GPS mouse allows datalogging (obviously with no timestamp on the SD file). Plug GPS in and restore power, lower-right LED blinks about 3-4Hz, and log button tries (top-right steady for a few seconds) then all go out, crash & burn.

So, maybe related to filecreation having a valid timestamp from GPS?

— Reply to this email directly or view it on GitHub https://github.com/autosportlabs/RaceCapture-Pro-firmware-mk1/issues/11#issuecomment-179604635 .

toga94m commented 8 years ago

Dangit, just downgraded to 2.8.5 and it does the same thing. I was on 2.8.5 when I did those fake autocross logs in January. I ran the 'testSD' at console and that worked fine, got a text file about slow dogs. Did a 'resetConfig' and no help. Card now has 195 files, all in the root, no subdirectories. It's an old Lexar 32MB (not GB!) fullsize SD.

Aha. I moved a bunch of files off the card, now 2.8.5 works again. Down to 68 files in root, and creating new timestamped logs again, starting with RC_0.log because I took the oldest 126 logs off the card... I believe it's an amazing coincidence that my card root directory got just as full as Steig's in the same week (assuming this fixes his card too).

Reflashed up to 2.8.7, and..... still works, 4 times in a row (with a powercycle in the middle). New logs are timestamped, have GPS coordinates, and no lazy dogs in the header.