Hello,
Recently I added TWI to my project it keeps a low consumption before call TWI functions to read or write after this my current consumption increases and keeps above 4mA when my device is in sleep mode
Current before TWI
sleep mode 5uA
standby 900uA
RF active 10mA
Current after TWI
sleep mode 4mA
Standby 5mA
RF active 14-16mA
I tried to disable TWI after read/write function using the following code with no luck
nrf_drv_twi_disable( &twi ); nrf_drv_twi_uninit( &twi); // Nordic work around to prevent burning excess power due to chip errata // Use 0x40003FFC for TWI0. *(volatile uint32_t *)0x40003FFC = 0; *(volatile uint32_t *)0x40003FFC; *(volatile uint32_t *)0x40003FFC = 1; // Initialize the TWI with the event handler set to NULL. Makes the read // and write operations blocking. Must be done each time because of the // power off of the peripheral done above. ret_code_t ret; ret = nrf_drv_twi_init( &twi, &twi_config, NULL, NULL ); APP_ERROR_CHECK( ret );
my Initialization function:
ret_code_t ret; ret = nrf_drv_twi_init(&twi, &twi_config, NULL, NULL); if (NRF_SUCCESS == ret) { nrf_drv_twi_enable(&twi); }
my read/write functions
//WRITE TWI ret_code_t ret =0; ret = nrf_drv_twi_tx(&m_twi_master, Address, (uint8_t *)&data, lenght, true); if (NRF_SUCCESS != ret) { return ret; } //READ TWI nrf_drv_twi_rx(&m_twi_master, Address, buffer, sizeof(buffer));
sdk_config:
I am using a NRF52 and SDK13 can someone give a hand with it
Regards