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

How to store efficiently an array with over 100 000 byte elements and send it over BLE?

Hi!

I'm using nRF51DK with s110_nRF51_8.0.0 Soft Device and SDK_9.0.0. My application reads ADC with frequency 500Hz (2 bytes of data from one sensor each read), and twi with frequency 20Hz(6 bytes of data from another sensor each read) and sends each measurment over BLE instantly. Now i would like to modify it so that it stores measurments for 90 seconds and then sends all the data over BLE. I assume that i can not just make such a big array by simply writing in my code uint8_t arr[100800];, and i should, for example, use Persistant Storage Manager or some other method to store the data in flash memory. and here is my question: what method/ driver should i use to store my data so that it wont disturb reading ADC with high frequency (and so that i could write data into array after every read from sensor)? And how to send data over BLE after I read and store them? Should I use long-write or just split it by 20 bytes and send one after another (sending doesnt have to be done fast)?

Regards, Ina

Parents
  • It is not possible to store over 100kbytes in RAM (as the nrf51822 is limited to 16/32 kbytes), so simply writing uint8_t arr[100800]; wouldn't work indeed.

    I don't think using flash memory would be fast enough to store these values, but if it even did, number of write cycles to flash memory is limited so I wouldn't recommend continuous writes to flash.

    I suggest using external sram memory (ex. on SPI) to store data. To send this data the fastest way is to use notifications (20b data packets)

  • It depends of the memory you are using... There are some 1Mbit SRAM chips that you can write using ex. TWI or SPI examples (you can find TWI and SPI library in SDK). But specific implementation depends of the chip that you use and its protocol... I dont think there is example for that in SDK.

Reply Children
No Data
Related