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.

Parents
    • 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);
                }
    
Reply
    • 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);
                }
    
Children
No Data
Related