I’ve got an Arduino Uno attached to some analog sensors and it is datalogging to a microSD card on Sparkfun’s microSD card shield - which runs on SPI. My quandary is I want to be able to then do a data dump via bluetooth to an iDevice or Mac or PC. For bluetooth I am using Adafruit’s nRF8001 which uses SPI.
Consider me a total newbie to SPI: how do i read a ~10MB data file on the SD card via SPI and then send that to the bluetooth chip also via SPI? Can I read one SPI device and write to the other simultaneously? Would I be better off with a different bluetooth chip (I want to stick with BLE4.0 if possible)? I understand SPI has full duplex communication, but can it do simultaneous half-duplex with each SPI slave?
Totally don’t know where to start on this one.
Use more links please
This Sparkfun micro SD shield ?
That one converts the 5V signals from the Arduino Uno to 3.3V signals for the micro SD card. That is good.
This Adafruit nRF8001 ?
You can use both "simultaneously". Every SPI function in the libraries enables the chip-select when it wants to do something with a SPI device, and disables it before returning.
Using the Arduino Uno to transfer 10MByte will take a long time. The Arduino Uno can be used for 10kByte. What if 10MByte takes half an hour ?
To send such a large file you would need to create a RAM buffer,
- read (next) part of the file from the SD card into the buffer,
- switch to BLE and send the buffer content,
- Loop back to 1 until entire file sent.
Hi, I am trying to do the same thing. I have a seeed v4 SD shield and I am using the SDFatLib to acquire data on 2 analog pins at 5kHz. I am also using the Adafruit nRF8001 BLE shield.
I have found out that the SD shield uses SPI_MODE_0 and the nRF8001 uses SPI_MODE_1.
When I instantiate the BLE object, the code (analogBinLogger.ino) will not record data.
If I were to use SPI transactions, to change from SPI_MODE_1 to SPI_MODE_0, will I lose BLE connection?
Assuming I get it to work, would I need to reconnect every time I toggle SPI modes?