I’m using SdCardLogHandlerRK (0.1.0) library along with the SdFat (1.0.16) library on our e-series hardware (2nd gen) and seeing a problem writing to an SD card connected via SPI.
When setting the .withSyncEveryEntry to true, everything works without problem. When setting it to false however, the SPI write’s appear to work, no errors are reported, but nothing is written out to the physical SDHC device (Kingston 16GB SDHC, FAT32 formatted), and any subsequent directory listings show that the file size is not changing.
The first entry in the terminal output shown below demonstrates the working state. See also the ‘SdSpiCardWithSyncEntryTrue MISO MOSO.jpeg’ file attached.
The remaining scope screenshots show the signals in the failure condition. From the terminal log, the SPI driver also appears to be performing correctly (no errors are reported, and a single writeBlock after >512 bytes are collected). As you can see from the directory listing however, the changes are not being committed to the SD. I’ve confirmed this by removing the SD card and taking a look at the files; nothing was in fact written. Any idea what the issue might be?
Cheers,
Paul
Terminal Log - withSyncEveryEntry( true )
SD /logs directory listing:
RB32768
RB32832
2022-01-11 19:05:18 95712 000001.txt
Reference:
- SdFat/src/SdCard/SdSpiCard.cpp, SdSpiCard::writeBlock(), SdSpiCard::readBlock()
- SdFat/src/FatLib/FatVolume.cpp, FatCache::sync();
0000325439 [app] TRACE: SENSORS READ STATE
RB32952
FatCache::sync() dirty
WB32952
RB32832
FatCache::sync() dirty
WB32832
0000326747 [app] TRACE: GPS READ STATE: last gps msg sent 0
Terminal Log - withSyncEveryEntry( false ):
0000727429 [app] TRACE: ALARM HANDLER STATE
FatCache::sync() dirty
WB33397
0000727432 [app] TRACE: SLEEP STATE
0000727934 [app] TRACE: ALARM HANDLER STATE
0000727935 [app] TRACE: SLEEP STATE
0000728439 [app] TRACE: ALARM HANDLER STATE
0000728440 [app] TRACE: SLEEP STATE
0000728942 [app] TRACE: ALARM HANDLER STATE
0000728943 [app] TRACE: SLEEP STATE
0000729447 [app] TRACE: ALARM HANDLER STATE
0000729448 [app] TRACE: SLEEP STATE
0000729950 [app] TRACE: ALARM HANDLER STATE
0000729951 [app] TRACE: SLEEP STATE
0000730455 [app] TRACE: update data
0000730455 [app] TRACE: MODBUS READ STATE
FatCache::sync() dirty
WB33398
0000730458 [app] TRACE: SENSORS READ STATE
SD /logs directory listing:
FatCache::sync() dirty
WB33552
RB32768
RB32832
FatCache::sync() dirty
WB3134
WB17951
2022-01-11 21:26:34 344300 000001.txt
SD /logs directory listing:
FatCache::sync() dirty
WB33548
RB32768
RB32832
2022-01-11 21:26:34 344300 000001.txt
0000082659 [app] TRACE: SEND CONFIG MSG STATE
RB33548