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

NRF52840 sleep current to hish after SPI transfer

Hello,

I have made a custom board based on NRF52840 IC.

The board is using GPIOTE, SPI2 and TWI1, and when put to sleep, consume 665µA.

When just initializing the SPI, but not making any transfer before going to sleep, the idle current is about 65µA, but if I transfer something over SPI, the current in sleep goes no lower than 660µA.

I tried the errata 89 workaround, without luck :

NRF_SPI2->ENABLE = 0;
NRF_TWI1->ENABLE = 0;
*(volatile uint32_t *)0x40004FFC = 0;
*(volatile uint32_t *)0x40004FFC;
*(volatile uint32_t *)0x40004FFC = 1;
*(volatile uint32_t *)0x40023FFC = 0;
*(volatile uint32_t *)0x40023FFC;
*(volatile uint32_t *)0x40023FFC = 1;

I put all SPI IOs to LOW before calling __WFE(), and the slave on the SPI bus is powered down.

The SPI code I use is based on the SPI example:

void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
                       void *                    p_context)
{
    spi_xfer_done = true;
}

void initSPI(){
  nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
  spi_config.ss_pin   = CS;
  spi_config.miso_pin = NRF_DRV_SPI_PIN_NOT_USED;
  spi_config.mosi_pin = MOSI;
  spi_config.sck_pin  = CLK;

  err_code = nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL);
  spi_xfer_done = true;
  //SEGGER_RTT_printf(0,"nrf_drv_spi_init returned: %d \n",err_code);

  nrf_gpio_cfg_output(DC);
  nrf_gpio_cfg_output(RES);
  nrf_gpio_cfg_input(BUSY, NRF_GPIO_PIN_PULLDOWN); //busy

  // Reset
  nrf_gpio_pin_clear(RES);
  nrf_delay_ms(200);
  nrf_gpio_pin_set(RES);
  nrf_delay_ms(200);

}

void sendCommand(unsigned char command){
	m_tx_buf[0]=command;
	spi_xfer_done = false;
	nrf_gpio_pin_clear(DC);
	nrf_drv_spi_transfer(&spi, m_tx_buf, 1, m_rx_buf, 1);
	while (!spi_xfer_done)
        {
            __WFE();
        }
}

I believe I don't do something that I should, maybe on the handler.

All current measurement are made without debugger pluged in.

Does someone have an idea of what may be the problem?

Thanks

Parents Reply Children
  • This chip markings are good.

    Even 45/65uA is a high value, is the current you measure average current or do you have a power profiler kit so you can see transitions and spikes that add up to the 45/65/665uA. 

    Can it be any floating gpios and/or current drawn through pull up/down resistors? Are you using IN event with GPIOTE or PORT event? Look for high accuracy bit when configure gpiote, use false for lowest current (GPIOTE event).

Related