Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 2 months ago. This question has been closed. Reason: Duplicate question
Temporary buffer of 25kB
I'm working with the nrf51822 mbed platform. I need some way to temporarily store about 20-25 kB of data downloaded over BLE, and send it up to the mother board over an SPI link. What's the best way to approach this? I am guessing I'd need some way of storing data on the internal flash. Is there an easy way to do this?
What I've tried so far: 1. Sending every received packet (20 bytes) directly up over SPI. This is not reliable, several packets are missed or messed up. I have to use software SPI because for some reason hardware SPI doesn't like the pins (0,1,2,3).
2. Trying to allocate 24 kB as a global variable (char array) - obviously doesn't work as the chip has only 16 kB RAM (only 8k available to app), but thought I'll try anyway.
3. Trying to allocate a 2D array of char, doesn't work either (as compiler wants to make it contiguous and then it's the same as #2 above).
What I'd like to try next: allocating 20 separate variables of 1200 bytes each so the compiler doesn't have to make them contiguous. I'm hoping that the chip will automatically page in the proper flash page on access.
Before I go further, I'd like to ask if I'm misunderstanding something obvious, or am I on the right track? Is there a better way to do this? I prefer not using the Nordic SoftDevice native API for accessing the flash storage, because I'm afraid of conflicting with the firmware OTA update mechanism which also uses internal flash as temporary storage.