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

nRF52840 multiperipheral with very low power sleep mode

Hello, I want to make multiperipheral system with nRF52840 (Im using 4x nRF52840DK). Im using latest SDK17. I wrote criteria i want to put to this system below:

1. Devices are supposed to be connected with BLE

- One central device

- Minimum three peripheral devices

2. Peripheral devices are supposed to be in sleep mode

- Sleep time ~1min

- System ON, full 256kB RAM retention, wake on GPIOTE - PORT event (power consumption in sleep mode less than 3uA)

- I don't want any advertising in sleep mode

3. Peripheral devices are supposed to be wake up with port event and then i want to send 8kB of data over BLE from RAM

- uint8_t data[8192];

- data need to be send with the highest througput posibble

4. Central device is supposed to only recieve data

- not needed sleep mode

- data need to be written in internal RAM (uint8_t data[3][8192];) or something similar

And my questions are:

How to start?

What are the best examples to modify?

It is posibble to achieve constant 3uA current consumption in sleep (1min) and after wake up send the data in 60ms (after that again go to sleep)?

Best regards

Rafał Dolny

Parents
  • Hello Rafal,

    First of all, do you intend to connect to several devices at once, or do you only need to connect to one at the time (at one minute intervals)?

    If you need more connections, I suggest you look into the ble_central\ble_app_multilink_central for inspiration, and change out the service (LBS, led button service) with the ble_nus_c sample.

    If you only need one connection at the time, start with the ble_app_uart_c as your central project. The peripherals can use the ble_app_uart example. 

    What you need to implement is the sleep system you like, and the transfer of the data. When you are done transferring, you can disconnect (can be done from the central or peripheral). Then when you disconnect, stop the advertisements (or don't start them), and set an app timer for 1 minute. If you are using System on mode, you can just leave the main function as is, and system on mode is used whenever it can from the main()'s while loop. 

     

    It is posibble to achieve constant 3uA current consumption in sleep (1min) and after wake up send the data in 60ms (after that again go to sleep)?

     Yes. That should be feasible (Not including when you are actually transferring all your data). 

    Best regards,

    Edvin

  • Hi Edvin,

    Thank You for Your reply. I don't know which solution is better for lowest possible current consumption. I think I can have one connection at the time. I've tried ble_app_uart & ble_app_uart_c but i haved some problems. I don't know how to disable advertising when Im not sending any data. Because of advertising I don't know in what kind of sleep mode it is. Can You tell me please (If You know) how to change ble_app_uart for something like that?

    1. Turn power on

    2. Connect BLE peripheral -> central

    3. Go to sleep (stop advertising)

    4. After for example push the button -> wake up

    5. Send data over BLE from data[8192] -> i thing there will be 34 packets per 244bytes

    6. Go to sleep (stop advertising) and wait for button

    Best regards,

    Rafał Dolny

  • Yes but when Im using system off mode i see that wake up and waiting for connection takes a lot of time (several seconds). Can I do it with "system on sleep" in miliseconds?

    Best regards

    Rafał Dolny

  • Yes you can. Just stop and start advertising as you like. The default state is system on sleep.

  • I'm trying something like this:

    1. Turn on power on peripheral

    2. I have global variable static volatile bool ble_connected (after reset is false)

    3. In main function after all initializations i'm advertising with advertising_start() function

    4. Now im sitting in main -> while(!ble_connected ) until BLE_GAP_EVT_CONNECTED (there im changing ble_connected to true)

    5. After that im waiting with nrf_delay_ms for send data with function ble_nus_data_send

    6. After transmission i'm using sd_ble_gap_adv_stop() but i see NRF_ERROR_INVALID_STATE

    It is a proper thinking? Where or when i can use sd_ble_gap_adv_stop() without errors?

    Without nrf_delay_ms device wasn't transmitting any data. How can I check proper moment for sending for achieve possible short time?

    Best regards

    Rafał Dolny

  • ustek1 said:
    6. After transmission i'm using sd_ble_gap_adv_stop() but i see NRF_ERROR_INVALID_STATE

     That is because you are not advertising. By default it will stop advertising when you enter the connection. Try sd_ble_gap_disconnect() to disconnect. Just note that when you disconnect, the BLE_GAP_EVT_DISCONNECTED event will by default start advertising (not from your main.c file, but from the ble_advertising.c file).

    To disable this, set ble_adv_on_disconnect_disabled = true in advertising_init():

    init.config.ble_adv_on_disconnect_disabled = true;

  • I've tried to disconnect with function sd_ble_gap_disconnect() and it works but i have problem with one thing. When I'm disconnecting peripheral and I want to connect it again and send data  i'm observing minimum 300ms of time between wake up to finish sending. I'm negotiating 2Mbps phy also and I think that connecting in that way is way too long. Can You tell me what exactly cause those spikes in interval connection period? This is advertising?

    Best regards

    Rafał Dolny

Reply
  • I've tried to disconnect with function sd_ble_gap_disconnect() and it works but i have problem with one thing. When I'm disconnecting peripheral and I want to connect it again and send data  i'm observing minimum 300ms of time between wake up to finish sending. I'm negotiating 2Mbps phy also and I think that connecting in that way is way too long. Can You tell me what exactly cause those spikes in interval connection period? This is advertising?

    Best regards

    Rafał Dolny

Children
Related