Sending data from a FRAM by SPI and immediately sending them by BLE

Hi everyone,

I am trying to create a system to collect data from different sensors and store them in a FRAM. Then by using SPI, I want to transfer the data to the nRF52832 development kit and immediately send them by BLE. And, finally after transmitting the data put the nRF radio device in off mode to save power consumption. this is critical in my project because we wanted to use a battery for nearly a month. So the algorithm is waking up the nRF, transferring data by SPI, Sending data by BLE, and again putting the device in off mode. is there any difference between idle mode and off mode? and how can I wake up the system to repeat this process?

I am trying to use UART example as a base project. is it possible to mix spi communication with nus service? does anyone have experience with this kind of project? 

Thank you

  • Hi Reza, 
    I don't see any problem doing what you plan to do. 
    My suggestion is to follow what we have in the spi example and then combine it with the uart-ble example. Of course you don't mix the uart communication with spi communication but only follow the way we get data from uart and send it over to BLE. 

    Please let us know which SDK you are using. 

  • Hi Hung,

    thank you for your reply. I am using SDK 17. 

  • Hi Reza, 
    You would need to study the SPI example to collect data. When the data is ready you then send it via BLE the same way as we did in the ble_app_uart example. 

  • Hi Hung,

    Actually, I used SPI communication example to connect an accelerometer to nRF device and there is no problem with that. I have some questions which I will be appreciated if you answer:

    1- should I create an array and first transfer the FRAM data to it and then send this array to the NUS communication or there is no need for that?

    2- I will collect the data in the FRAM for 2 minutes, so it could be around 5 Kb of data. is it possible to transfer them with NUS? I see that each time we can send only 244 bytes of data.

    3- is idle_state_handle(); function is good to put the radio in off mode? I want to put the nRF device in completely off mode to save power. I read some articles that idle_state_handle(); doesn't put the Nrf in off mode. What do you suggest for that?

    4- suppose that nRF device is in off mode and the FRAM is ready to transfer the data to nRF, how can I wake up the nRF device?

    Sorry for all these questions.

    Thanks.

  • Hi Reza, 

    1. I assume you communicate your FRAM from the nRF chip via SPI ? In that case you need to copy the data from FRAM to an array and supply the array to the BLE (NUS) communication

    2. I don't see any problem sending 5kB of data. You can achieve 6-700kbps with BLE. 

    3. idle_state_handle() is good for low power consumption. Note that it doesn't put the chip to OFF mode, it put the CPU and other unnecessary peripheral to sleep mode. This way you still can keep the connection when consume very little power. 

    4. When there is an interrupt, it will wake the CPU up and you are ready to transfer data. It's the same case with the ble_app_uart example.  

Related