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

Basic mechanism of running examples for power efficiency

I'm quite new to nrf.

These days I'm trying to program power efficient uart data sender over ble.

It receives uart and sends data fine.

The problem is it's not going into sleep mode properly and consumes about 883uA or 544uA(DCDC mode) on idle.

But what I'm trying to understand is not just making this project into ultra low power uart data sender perfectly.

I'm trying to understand basic structure.

Even if I run ble_app_beacon example, I wonder why advertising signal repeats when the code is not in a for loop or while loop or a thread starter.

The beacon code looks like this

int main(void)
{
    // Initialize.
    log_init();
    timers_init();
    leds_init();
    power_management_init();
    ble_stack_init();
    advertising_init();

    // Start execution.
    NRF_LOG_INFO("Beacon example started.");
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        idle_state_handle();
    }
}

as you can see, only the idle_state_handle is in the loop.

So when beacon app is not going into sleep mode between advertising signals,

I would imagine I'd have to look into other repeating commands like for loop or while loop but there's no such thing other than idle_state_handle which merely calls sd_app_evt_wait() so it can go to sleep mode.

in the uart project I'm working on, when the programmed nrf52840 dongle connects to the other device over ble,

It is also programmed to send received data from arduino(UART data) to the other dongle which sends received data to usb so I can check the data in the PC

This also doesn't go to sleep in between sending uart signals.

So I would also imagine I'd have to go into uart data sending function like uart_event_handle() but there is no for,while loop in this or thread starter for that matter.

So how should I debug similar projects?

I'm guessing there must be some order that I can understand so I could pin-point which spot(code) is causing excessive power consumption

or what I have to do before putting it into sleep mode.

Parents Reply
  • Thanks for your reply.

    We're currently developing this for uart communication. I don't think we can do bit banging.

    I had a look at your code, seems that you still do BLE advertising. So the current consumption will include the BLE activity.

    Do you mean I have to explicitly disable advertising activity after connection? The current setup automatically connects to central dongle. It seems the current changes from advertising peaks to connected peaks every 30ms(one small peak and two high consecutive peaks after)

    I doubt this is needed because even when advertising, idle current is still pretty high. And only when uart_init() is commented out, it reaches the bottom both in ble connection, without ble connection.

    I would suggest to test and measure the current consumption using a DK first. And then you can start testing on the dongle. 

    Unfortunately I don't have an extra DK to test this. Only nRF52840 dongles.

Children
Related