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

Peak current when the nRF52 is in the SYSTEM ON mode

Hello,

I have done some consumption measurement but I have a strange behaviour while the nRF52840 is in the SYSTEM ON mode.

For the measurement, I send advertising packet each 1 second and then I put the nRF52840 in the SYSTEM ON mode. When the system is in SYSTEM ON mode I measure peak, but I don't know why. Are there any internal process in SYSTEM ON mode that generate these peaks ?

Plot of the measurement:

Test setup :

  - Segger Embedded Studio - SDK V14.2 SoftDevices 5
  - Windows
  - PCA10056 - nRF52840-PDK

Parents Reply Children
  • This is a broadcaster so there're no connection.

    Yes, same result with beacon example. In fact, I use the same principle ...

    Here's the basic test code : 

    static void advertising_init(void){
        uint32_t      err_code;
        int8_t tx_power = 0;
        ble_gap_conn_sec_mode_t sec_mode;
        
        ble_advdata_manuf_data_t manuf_specific_data;
        ble_advdata_t advdata;
        
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
        err_code = sd_ble_gap_device_name_set(&sec_mode,
                                              (const uint8_t *) DEVICE_NAME,
                                              strlen(DEVICE_NAME));
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_ble_gap_tx_power_set(tx_power);//Set the radio's transmit power in dBm.
            
        sd_power_dcdc_mode_set(1);
        
        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
        manuf_specific_data.data.p_data = (uint8_t *) BLE_data;
        manuf_specific_data.data.size   = sizeof(BLE_data);
    
        // Build and set advertising data.
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type             = BLE_ADVDATA_FULL_NAME;
        //advdata.short_name_len        = strlen(DEVICE_NAME)-3;
        advdata.flags                 = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
        advdata.p_manuf_specific_data = &manuf_specific_data;
    
        err_code = ble_advdata_set(&advdata, NULL);
        APP_ERROR_CHECK(err_code);
        // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));
    
        m_adv_params.type            = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;//BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;//
        m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
        m_adv_params.fp              = BLE_GAP_ADV_FP_ANY;
        m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
        m_adv_params.timeout         = 0;       // Never time out.
    }
    
    /**@brief Function for initializing the BLE stack.
     *
     * @details Initializes the SoftDevice and the BLE event interrupt.
     */
    static void ble_stack_init(void){
    
        ret_code_t err_code;
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
    
        // Configure the BLE stack using the default settings.
        // Fetch the start address of the application RAM.
        uint32_t ram_start = 0;
        err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Enable BLE stack.
        err_code = nrf_sdh_ble_enable(&ram_start);
        APP_ERROR_CHECK(err_code);
    }
    
    static void advertising_start(void){
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_start(&m_adv_params, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }
    
    int main(void)
    {    
      
      ble_stack_init();
      advertising_init();
      advertising_start();
    
    while (1){
        
                power_manage();
        }
    }

  • Hi,

    Could you post the whole main.c file ?

    How are you powering the board? USB or external supply?

    What device are you using to measure the current?

    Are you measuring on P22? Could you cut the PCB track shorting solder bridge SB40 and SB41 ?

  • I will check to post the main.c, but uncomfortable because it is part of a whole project. I don't know if it'll work.

    /**
     * Copyright (c) 2018, AUTHOR: Sylvain Petre
     * 
     * All rights reserved.
     * 
     *  This software is developed as part of a master thesis.
     *  It consists to:
     *    - control the heater interface of a MOX sensor with a PID regulator.
     *    - read the conditioned data from the sensing layer of the sensor.
     *    - broadcast all the data through BLE following a formatted frame.
     * 
     */
    
    #include "sdk_config.h"
    
    #include "nrf_gpio.h"
    #include "boards.h"
    #include "app_error.h"
    #include <string.h>
    
    #include "nrf_drv_rtc.h"
    #include "nrf_drv_saadc.h"
    #include "nrf_drv_twi.h"
    #include "nrf_delay.h"
    
    #include "nrf_pwr_mgmt.h"
    
    #include "nrf_soc.h"
    #include "nrf_sdh.h"
    #include "nrf_sdh_ble.h"
    #include "ble_advdata.h"
    
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    
    const uint8_t DEVICE_NAME [] = "VOC03";
    
    #define APP_BLE_CONN_CFG_TAG            1                                 /**< A tag identifying the SoftDevice BLE configuration. */
    
    #define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(100, UNIT_0_625_MS) /**< The advertising interval for non-connectable advertisement (100 ms). This value can vary between 100ms to 10.24s). */
    
    #define APP_COMPANY_IDENTIFIER          0x0059                             /**< Company identifier for Nordic Semiconductor ASA. as per www.bluetooth.org. */
    
    #define DEAD_BEEF                       0xDEADBEEF                        /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */
    
    #define BLE_data_LENGTH                 0x1F                             /**< 31 bytes is the maximum size for adv data. */ 
    
    #define CAYENNE_LPP_FRAME_LENGTH        0x17                              /**< Total length of information advertised by the Beacon. */
    
    char BLE_data [15] = {0xFF};
    
    static ble_gap_adv_params_t m_adv_params;                                 /**< Parameters to be passed to the stack when starting advertising. */
    
    
    /**@brief Function for starting advertising.
     */
    static void advertising_start(void){
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_start(&m_adv_params, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }
    
    /**@brief Function for stop advertising.
     */
    static void advertising_stop(void){
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_stop();
        APP_ERROR_CHECK(err_code);
    }
    
    /**@brief Function for initializing the Advertising functionality.
     *
     * @details Encodes the required advertising data and passes it to the stack.
     *          Also builds a structure to be passed to the stack when starting advertising.
     */
    static void advertising_init(void){
        uint32_t      err_code;
        int8_t tx_power = 0;
        ble_gap_conn_sec_mode_t sec_mode;
        
        ble_advdata_manuf_data_t manuf_specific_data;
        ble_advdata_t advdata;
        
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
        err_code = sd_ble_gap_device_name_set(&sec_mode,
                                              (const uint8_t *) DEVICE_NAME,
                                              strlen(DEVICE_NAME));
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_ble_gap_tx_power_set(tx_power);//Set the radio's transmit power in dBm.
            
        sd_power_dcdc_mode_set(1);
        
        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
        manuf_specific_data.data.p_data = (uint8_t *) BLE_data;
        manuf_specific_data.data.size   = sizeof(BLE_data);
    
        // Build and set advertising data.
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type             = BLE_ADVDATA_FULL_NAME;
        //advdata.short_name_len        = strlen(DEVICE_NAME)-3;
        advdata.flags                 = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
        advdata.p_manuf_specific_data = &manuf_specific_data;
    
        err_code = ble_advdata_set(&advdata, NULL);
        APP_ERROR_CHECK(err_code);
        // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));
    
        m_adv_params.type            = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;//BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;//
        m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
        m_adv_params.fp              = BLE_GAP_ADV_FP_ANY;
        m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
        m_adv_params.timeout         = 0;       // Never time out.
    }
    
    /**@brief Function for initializing the BLE stack.
     *
     * @details Initializes the SoftDevice and the BLE event interrupt.
     */
    static void ble_stack_init(void){
    
        ret_code_t err_code;
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
    
        // Configure the BLE stack using the default settings.
        // Fetch the start address of the application RAM.
        uint32_t ram_start = 0;
        err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Enable BLE stack.
        err_code = nrf_sdh_ble_enable(&ram_start);
        APP_ERROR_CHECK(err_code);
    }
    
    /**@brief Function for doing power management. */
    static void power_manage(void){
    
        ret_code_t err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
    
    int main(void)
    {    
      ble_stack_init();
      advertising_init();
      advertising_start();
          
    while (1){
    
            if (NRF_LOG_PROCESS() == false)
            {
                power_manage();
            }
        }
    }

    - I used a USB supply with nRF only switch ON.
    - Tektronix DMM7510
    - Yes I measure the current through P22

  • I tested your code on a nRF52840-PDK, and it didn't show any of these peaks here.

    Image from Nordic PPK:

    * If the PDK is connected to a USB-hub, could you try to connect it directly to the computer?

    * Have you connected any external sensors to the PDK ?

    * I see that you have plotted the measurement in Matlab or something similar, did you see the same peaks directly on the Tektronix DMM7510 display also?

  • I'll perfom new measurements in the following days to be sure of the test condition.

    What's the sampling frequency of the Nordic PPK ?

    Yes, I saw the same result on the DMM7510.

Related