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

nRF52832 SPI Slave Pulls Excessive Idle Current

Hello everone,

I'm currently seeing about 10-11 uA additional IDLE current when the SPIS peripheral is enabled, but unused. In the nRF5 SDK v15.0.0, the SPIS example draws approximately 12.5uA when the SPI connections are pulled to appropriate voltages and disconnected from pads (see modified code below, using DCDC regulator).

 

Modified main() of `examples/peripheral/spis/main.c`:

int main(void)                                                                                                                        
{                                                                                                                                     
    // Enable the constant latency sub power mode to minimize the time it takes                                                       
    // for the SPIS peripheral to become active after the CSN line is asserted                                                        
    // (when the CPU is in sleep mode).                                                                                               
    //NRF_POWER->TASKS_CONSTLAT = 1;                                                                                                  
    NRF_POWER->TASKS_LOWPWR = 1;                                                                                                      
                                                                                                                                      
    NRF_POWER->DCDCEN = 1;                                                                                                            
                                                                                                                                      
    nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;                                                                  
    spis_config.csn_pin               = APP_SPIS_CS_PIN;                                                                              
    spis_config.csn_pullup            = NRF_GPIO_PIN_PULLUP;                                                                          
    spis_config.miso_pin              = APP_SPIS_MISO_PIN;                                                                            
    spis_config.mosi_pin              = APP_SPIS_MOSI_PIN;                                                                            
    spis_config.sck_pin               = APP_SPIS_SCK_PIN;                                                                             
                                                                                                                                      
    APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));
    
    nrf_gpio_cfg(APP_SPIS_CS_PIN,                                                                                                     
                 NRF_GPIO_PIN_DIR_INPUT,                                                                                              
                 NRF_GPIO_PIN_INPUT_DISCONNECT,                                                                                       
                 NRF_GPIO_PIN_PULLUP,                                                                                                 
                 NRF_GPIO_PIN_S0S1,                                                                                                   
                 NRF_GPIO_PIN_NOSENSE);                                                                                               
                                                                                                                                      
    nrf_gpio_cfg(APP_SPIS_MISO_PIN,                                                                                                   
                 NRF_GPIO_PIN_DIR_OUTPUT,                                                                                             
                 NRF_GPIO_PIN_INPUT_DISCONNECT,                                                                                       
                 NRF_GPIO_PIN_PULLDOWN,                                                                                               
                 NRF_GPIO_PIN_S0S1,                                                                                                   
                 NRF_GPIO_PIN_NOSENSE);                                                                                               
                                                                                                                                      
    nrf_gpio_cfg(APP_SPIS_SCK_PIN,                                                                                                    
                 NRF_GPIO_PIN_DIR_INPUT,                                                                                              
                 NRF_GPIO_PIN_INPUT_DISCONNECT,                                                                                       
                 NRF_GPIO_PIN_PULLDOWN,                                                                                               
                 NRF_GPIO_PIN_S0S1,                                                                                                   
                 NRF_GPIO_PIN_NOSENSE);                                                                                               
                                                                                                                                      
    nrf_gpio_cfg(APP_SPIS_MOSI_PIN,                                                                                                   
                 NRF_GPIO_PIN_DIR_INPUT,                                                                                              
                 NRF_GPIO_PIN_INPUT_DISCONNECT,                                                                                       
                 NRF_GPIO_PIN_PULLDOWN,                                                                                               
                 NRF_GPIO_PIN_S0S1,                                                                                                   
                 NRF_GPIO_PIN_NOSENSE); 
                     
    while (1)                                                                                                                         
    {                                                                                                                                 
        memset(m_rx_buf, 0, m_length);                                                                                                
        spis_xfer_done = false;                                                                                                       
                                                                                                                                      
        APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&spis, m_tx_buf, m_length, m_rx_buf, m_length));                                     
                                                                                                                                      
        while (!spis_xfer_done)                                                                                                       
        {                                                                                                                             
            __WFE();                                                                                                                  
            __SEV();                                                                                                                  
            __WFE();                                                                                                                  
        }                                                                                                                             
    }

However, if the SPIS is disabled by adding nrfx_spis_uninit(&spis); right before the while(1), the overall current will drop to approximately 1-2 uA average.

This extra current doesn't seem to line up with anything shown in the data sheet for the part. Does anyone know where the current may be coming from?

For additional reference, I'm measuring current with the nRF52-DK nRF Current Measurement header with SB5-SB8, SB9, SB22-SB25, and SB30 cut.

Thanks in advance!

Related