This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

software TWI 1.3mA OFF MODE

Using twi_sw_master have discovered that the nrf51422 E00 draws 1.3mA in off mode.

When the twi device is removed from the bus, the nrf51422 draws under 5uA in off mode.

I have created twi_hw_master.c correctly using SHORTS github.com/.../twi_hw_master.c

I turn hardware twi off using

NRF_TWI1->POWER  = 1;
NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;


// do your I2C stuff here

NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;
NRF_TWI1->POWER  = 0;

This works fine with the mpu6500, but does not with the hmc5983. I suspect the hmc5983 is some how keeping the nrf51422 twi active.

The solution could be to upmap the twi pins disconnecting the nrf51422 from the twi bus, so that the twi bus does not keep the nrf51422 active.

HOW should I unmap the twi pins? So that the nrf51422 is not effected by the twi bus?

Remapping twi pins or anything that may cause twi communication problems, causes the softdevice to HANG or not function correctly. This includes Advertising timeout not functioning, or hanging the nrf51422 on ble bonding.

Simple disabling pullups does not allow working around twi communication issues.

  • Did you do a full reset (removing and re-applying the voltage to the chip) to disable the debug interface? Before doing the current measurement? Please see this question for more info.

  • Yes, I perform a hard power reset, with the jtag disconnected before taking current measurements. I use the same testing process with and without the twi device attached.

    • When the twi device is attached the off state current is 1.3mA, combined the twi device itself consuming under 10uA (I verified this by hacking the hardware)
    • When the twi device is detached the off state current is under 5uA, approximate 3uA
    • I have tried twi_hw_master.c and twi_sw_master.c with the following system off function.
    • It still does not reduce the power below 1.3mA called from within on_ble_evt

    see

    static void on_ble_evt(ble_evt_t * p_ble_evt)
        {
        //........
            case BLE_GAP_EVT_TIMEOUT:
                if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT)
                {
        // Go to system-off mode (this function will not return; wakeup will cause a reset)
                    system_off_mode_enter();
                }
                break;
        //.....
        }
            
                void system_off_mode_enter(void)
                {
                    uint32_t err_code;
                    /*
                    * OFF STATE
                    */
                    all_timers_stop();
               
                    NRF_TWI1->ENABLE  = (TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos);
                    NRF_TWI1->POWER   = 0;
                    sd_clock_hfclk_release();
                    nrf_delay_ms(1000);
                    err_code = sd_power_system_off();
                    APP_ERROR_CHECK(err_code);
                }
    
  • correction the system_off_mode_enter function works with soft device. After releasing the hfclk I do not request it again and the result is less power consumption while bonded.

    The complete power consumption nrf51422 and mpu6500 in off state is about 20uA

Related