greiman/SdFat

sdfat does one write to sd and then nothing

proasnet opened this issue · 1 comments

I am using sdfat library version 2.2.0 in my project
CPU is Atmel Mega 2560, sd is via SPI interface. In the setup routine, the initialization takes place successfully, then the first writing takes place, the headers of the csv files, the files are saved successfully.
In the routine loop, the time interval for the logger is every 10 minutes. However, when logging is started, nothing is written to the files, the print command does not return any error. I believe it's some kind of timeout, but I don't know where, or if there is a command to just keep the tab connected through each loop.

I put a sd.printSdError(&Serial); into a called functions for logging, and a some time later, I get this error code
SD error: SD_CARD_ERROR_CMD18 = 0xC,0xFF

SdCard Info return this:

09:59:19.935 -> init time: 23 ms
09:59:19.935 -> 
09:59:19.935 -> Card type: SDHC
09:59:19.935 -> sdSpecVer: 5.00
09:59:19.935 -> HighSpeedMode: false
09:59:19.935 -> 
09:59:19.935 -> Manufacturer ID: 0X3
09:59:19.935 -> OEM ID: SD
09:59:19.935 -> Product: SL16G
09:59:20.088 -> Revision: 8.0
09:59:20.088 -> Serial number: 0XE9D81E6D
09:59:20.088 -> Manufacturing date: 12/2017
09:59:20.088 -> 
09:59:20.088 -> cardSize: 15931.54 MB (MB = 1,000,000 bytes)
09:59:20.088 -> flashEraseSize: 128 blocks
09:59:20.183 -> eraseSingleBlock: true
09:59:20.183 -> dataAfterErase: zeros
09:59:20.183 -> 
09:59:20.183 -> OCR: 0XC0FF8000
09:59:20.183 -> 
09:59:20.183 -> SD Partition Table
09:59:20.183 -> part,boot,bgnCHS[3],type,endCHS[3],start,length
09:59:20.305 -> 1,0X0,0X82,0X3,0X0,0XC,0XFE,0XFF,0XFF,8192,31108096
09:59:20.305 -> 2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
09:59:20.305 -> 3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
09:59:20.434 -> 4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
09:59:20.434 -> 
09:59:20.434 -> Scanning FAT, please wait.
09:59:24.058 -> 
09:59:24.058 -> Volume is FAT32
09:59:24.058 -> sectorsPerCluster: 64
09:59:24.058 -> fatStartSector:    8790
09:59:24.058 -> dataStartSector:   16384
09:59:24.058 -> clusterCount:      485936
09:59:24.058 -> freeClusterCount:  485935
09:59:24.111 -> 

The problem is solved
I rewrite
const uint8_t SD_CS_PIN = SS;
to
const uint8_t SD_CS_PIN = 4;