Hi,
I have a Teensy 4.1 that writes to exFAT card. Using the Jan 2022 Teensyduino which I believe the most recent. It's for a datalogger. I want two log files. I write to the files by appending to them in loop(), once every 100 ms, one file after the other.
What's happening is that after 256 kB has been appended with 8 kB blocks without any issues, the file(s) on the SD card no longer wants to be written to.
But if I only append to one file, then all works fine.
When I write to both files successively, then after crossing the 256kB size limit and only when writing to two files instead of just one, then the file no longer grows in size. Write attempts simply fail.
The strange thing is that the write-failed file on that SD card then remains 'broken'. Also when I reboot the Teensy, or power cycle it. Only reformatting the SD card (I use my Windows 11 PC for that) fixes it. Or starting over with a new filename. But then that new one also only does the first 256 kB, and then nothing can be added.
Looks to me like a bug in the exFAT SD card libraries.
I'm using (SdioConfig(FIFO_SDIO)). Could that be it?
Archived example project attached. Only 55 lines. Reduced to the bare minimum size just to isolate and highlight the issue.
To replicate that it does work ok with just one file, comment out line 53 (write_to_log_file (filename_B);) , erase the card (or change the file names), and then the A file does grow beyond 256 k.
Anyone any ideas? exFAT directory tables get corrupted?
For info, this is what I use as SD card:
SD card Manufacturer ID: 0x1b OEM ID:0x534d (SM)
Product: ED4QT
Version: 3.0
Serial number: 0x0e534a33 = 240339507
Manufacturing date: 2/2011
SD card formatted for exFATSD: ok
I have a Teensy 4.1 that writes to exFAT card. Using the Jan 2022 Teensyduino which I believe the most recent. It's for a datalogger. I want two log files. I write to the files by appending to them in loop(), once every 100 ms, one file after the other.
What's happening is that after 256 kB has been appended with 8 kB blocks without any issues, the file(s) on the SD card no longer wants to be written to.
But if I only append to one file, then all works fine.
When I write to both files successively, then after crossing the 256kB size limit and only when writing to two files instead of just one, then the file no longer grows in size. Write attempts simply fail.
The strange thing is that the write-failed file on that SD card then remains 'broken'. Also when I reboot the Teensy, or power cycle it. Only reformatting the SD card (I use my Windows 11 PC for that) fixes it. Or starting over with a new filename. But then that new one also only does the first 256 kB, and then nothing can be added.
Looks to me like a bug in the exFAT SD card libraries.
I'm using (SdioConfig(FIFO_SDIO)). Could that be it?
Archived example project attached. Only 55 lines. Reduced to the bare minimum size just to isolate and highlight the issue.
To replicate that it does work ok with just one file, comment out line 53 (write_to_log_file (filename_B);) , erase the card (or change the file names), and then the A file does grow beyond 256 k.
Anyone any ideas? exFAT directory tables get corrupted?
For info, this is what I use as SD card:
SD card Manufacturer ID: 0x1b OEM ID:0x534d (SM)
Product: ED4QT
Version: 3.0
Serial number: 0x0e534a33 = 240339507
Manufacturing date: 2/2011
SD card formatted for exFATSD: ok