Hi everybody!
I'm using SdFat lib, Arduino Mega 2560 and such a SD card reader:
I've connected pins like it's written in Arduino Mega datasheet:
MOSI - pin 51
MISO - 50
SCK - 52
CS from card reader is connected to pin 53, and I specify chipSelect as 53 when calling SdFat::init. Card is initializing without errors and I can read files.
But I have troubles with writing files. I can't open file with a trunc flag - I get 0x13 error; also I can't change it's size, e.g. if file is of X bytes, then having opened it in write mode, I can't write more than X bytes and expand it. Also I can't delete file. (card isn't locked, of course, I've checked it ). I tried to supply card reader either with 3.3V and 5V, results are the same. I was advised to slow down SPI speed, I also tried it, but it didn't work even with one sexteenth of clock speed.
I have no idea what to do with it.
I used that same card reader and SdFat with Uno, and all worked fine.