Closed macster110 closed 2 years ago
It does not make much sense to me that an old Arduino Uno can write to an SD card faster than an RP2040 board?
It's the mbed SPI driver used in the Arduino package. I bought a number of RP2040 boards and was disappointed.
I also found a basic flaw in the ADC, only good to about 8-9 bits, so I gave up using the RP2040.
You might try editing SdFatConfig.h and set USE_SPI_ARRAY_TRANSFER to one at about line 130. I have not tried this lately on RP2040.
/**
* If USE_SPI_ARRAY_TRANSFER is non-zero and the standard SPI library is
* use, the array transfer function, transfer(buf, size), will be used.
* This option will allocate up to a 512 byte temporary buffer for send.
* This may be faster for some boards. Do not use this with AVR boards.
*/
#ifndef USE_SPI_ARRAY_TRANSFER
#define USE_SPI_ARRAY_TRANSFER 0
#endif // USE_SPI_ARRAY_TRANSFER
Thanks Greiman, that is good to know. Could you elaborate a bit more on the ADC issue?
You might try editing SdFatConfig.h and set USE_SPI_ARRAY_TRANSFER to one at about line 130. I have not tried this lately on RP2040.
Wow, that worked! The SD card write speeds are now 1700 kB/sec - thanks very much! I was really happy with this library so very pleased I can use it still! Thanks for all the help.
I'd still be keen to hear about this ADC issue only being good to 8-9 bits? I know there is a well documented issue with some non linearlity - is this what you mean?
See sections "4.9.3. ADC ENOB" and "4.9.4. INL and DNL" on page 588 of this document:
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
It is a fundamental design problem with the SAR ADC caps. ENOB typically 8-9.
I have been using your excellent SdFat library to write data to microSD cards but have encountered an issue with slow write speeds on RP2040 boards. I have tried using multiple SD cards (Fat32 and exFAT formatted), an Arduino Nano Connect RP2040 and Sparkfun Things Plus RP2040 board and I can only ever achieve write speeds of around 140kB/S dumping binary data into a file. I also tried a 32GB card (which had 140Kb/sec write speed with RP2040 boards) with an Arduino Uno and managed to get write speeds of around 700kB/sec.
It does not make much sense to me that an old Arduino Uno can write to an SD card faster than an RP2040 board? Does anyone have an ideas how I could speed up write speeds or what I might be doing wrong here?
The code I used to test is adapted from the SdFat library - see below. I have also tried writing blocks sequentially but that did from your ADC logger examples but that did not speed things up.
Hardware wise, the Sparkfun Things Plus has a built in SD card slot and I used this breakout board for the Arduino Nano Connect RP2040 and Arduino Uno.
Any help much appreciated.