I agree that since I'm not using the Uno's internal RAM, I'm losing some of the actual data rate but how could I test how much is lost during that process?
I'm actually doing sequential access since I'm building essentially a data logger. :D
If I were to throw in another SPI device, would they share an equal amount of bandwidth or will one take more of a priority if its used more often? In short, how would bandwidth be calculated then?
The best option is to capture the time before and after the transaction (use micros() and two unsigned long variables); but try to do a transfer with multiple lines of code, loops have their own implicit overhead as well. Don't forget to set the SPI's clock to 8 MHz, which is the fastest possible speed.
I'm assuming 8MHz is for the 3.3V version with the Atmega328 processor
Do I have to capture to transaction of the entire process (writing then reading) or is it enough to just capture a write or a read?
but I'd have to use a for loop to read out the data(Issue command to read, send starting address/data/# of bytes). The # of bytes is just so that I could read the data in a for loop since I don't think I can avoid not using one.
Could I use SPI.begin() instead of: SPI.begintransaction(16000000,MSBFIRST,SPIMODE0)/SPI.endtransaction(...)? I'm not sure if SPI.begin() is using the max clock speed like SPI.begintransaction().
I know SPI.begintransaction() stops the SPI bus
but would it be okay to just keep it running since I'm building a datalogger?I'd like to throw in a SDcard that uses SPI as well and I know they could both share the port as long as I have a different chipselect for it.
I did a few runs and wanted to see if ~50Bytes/sec seems reasonable or not
considering that ~888,888 bits/second is the max data transfer rate due to Arduino Uno capability.
In the end, I don't want to be calling the SRAM and SD card more than it needs to be.
Really? 50 B/s? Honestly, I've expected way more, even for random (single byte) transactions.Are you sure it is set to at least 8 MHz?
Is that why is so slow? You never told you've been making a double transfer.
It turns out to be ~26700 Bytes/second. Only a fourth of the maximum transfer rate.
I do have somewhat long wires which may interfere with the transfer rate.
Essentially when the SRAM is done reading out the data, the SD card will take over the bus and transfer it all at once.
PD: the double transfer can be faster if you put the SRAM readouts directly into the SD's cache, but it's easier said than done because that cache is also required for some filesystem stuff.
Note that this doesn't account for overhead.