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

TWI in Low Power...

Hey guys,

Trying to use TWI in the lowest power way possible, non-blocking. Is this the right way to do it? When I run this, I get the callback event handler to execute once, and once only -- seemingly stuck in WFE() or sd_app_evt_wait() , not waking up with the callback. Any ideas as to why?

  nrf_drv_twi_init(&p_twi_instance, &p_twi_config, twi_event_handler); 
  nrf_drv_twi_enable(&p_twi_instance); // Enable the TWI instance   

while(1) {
 
    nrf_drv_twi_rx(&p_twi_instance, 0x55, dummy_data, 7, false);          

    //power_manage(); //sd_app_evt_wait(); //if using SD                                                                                                                                        
    __WFE();   
}
    
static void twi_event_handler(nrf_drv_twi_evt_t *p_evt){   
    if(p_evt->type == NRF_DRV_TWI_RX_DONE)
    {

      SEGGER_RTT_printf(0, "\n\nDATA: ", dummy_data);
      for(i=0;i<7;i++) SEGGER_RTT_printf(0, "%02x ", dummy_data[i]);

    } 
}
Parents Reply Children
No Data
Related