This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Stream Data from SPIS to S130 SoftDevice on nRF51822

Hi Nordic Community,

I am using the nRF51822 to receive a data stream from the SPIS module and transfer the data directly to a phone over BLE using the S130 softdevice. My data ranges from 2kB to 40kB so reading it into RAM and then transferring to the SD is not an option. I am trying to figure out the best way to buffer the data from SPIS to SD with the least amount of overhead and being able to meet timing requirements. The problems I face are listed below:

  • How can I deal with the difference in throughput of the SPIS module and BLE. They are orders of magnitude difference. If I let both modules run, the SPIS module will read data in much faster than the SD can get it out.
  • How can the SD and SPIS module communicate so that any intermediate buffers are not overflowed and throughput is maximized.
  • If the SD blocks the processor, how can I receive data for the next packet from SPIS and be ready to send it to the SD? DMA?

There is a lot of functionality and options built into the NRF and I am hoping some of you with more experience can point me in the right direction to solve this problem!

Parents
  • Hi

    Good questions.

    For latest BLE throughput tuning advice, this thread could help. For SPIS throughput considerations, this thread could give pointers. This thread could also give some pointers on the SPIS side and also for the SPI master side.

    Optimally you would want to transfer 20 byte packets and configure the softdevice for 6 packets per connection event and set the BLE connection interval to minimum 7.5ms for maximum throughput, but this may be limited by the BLE peer side as mentioned on the first link above.

    Is all the data you mention in a single SPI transaction? Do you have some control over the SPI master side? Optimally, you would have control line from SPIS to SPI master, letting the slave indicate when it is safe for the master to send data. The master could send 120 bytes when it receives signal. The SPIS would get "transaction finished" event and send 6 packets of data over BLE, each with 20 bytes (fewer packets if the BLE peer device limits packets per connection event). Signal the SPI master again when the softdevice has received all the packets.

  • Hi Stefan, thanks for your response! I have a RDY line that is controlled by the SPI slave that indicates to the master when it is ready. The problem I am running into, is that in some situations, the slave also needs to tell the master that it has data to send, which is what the RDY is currently used for. I think I am going to need another line, so I have a RDY and REQ line for the spi slave both being ready and wanting to send data. I could implement one of these in software in the form of some type of acknowledge pack instead of RDY? With only 1 extra line on my SPI connection, what do you think the best way to do this is?

Reply
  • Hi Stefan, thanks for your response! I have a RDY line that is controlled by the SPI slave that indicates to the master when it is ready. The problem I am running into, is that in some situations, the slave also needs to tell the master that it has data to send, which is what the RDY is currently used for. I think I am going to need another line, so I have a RDY and REQ line for the spi slave both being ready and wanting to send data. I could implement one of these in software in the form of some type of acknowledge pack instead of RDY? With only 1 extra line on my SPI connection, what do you think the best way to do this is?

Children
No Data
Related