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

TWI sticking in twi_master_read polling for NRF_TWI1->EVENTS_STOPPED

Hey all,

I have a custom board running a 51822 rev C0 chip connected to a TMP102 temp sensor over I2C. I was using the twi_sw_master.c to successfully talk to it in my main loop before I start the advertising and application timers (and therefore im guessing the soft device). This was working fine here, but when I was calling my temp sensor reading function on the button handler then I would get an app_error_handler from within the soft device (v6). After nosing around on the forums, I realised that the hardware version of I2C should be working now so I switched over to that. I am using the twi_hw_master.c from github.com/.../twi-display-5.1.0 so it should have all the "bug fixes" included in it. However, in my main loop version (which WAS working in the bit bash mode) I am getting stuck in the while loop below at the bottom of twi_master_read.

/** @snippet [TWI HW master read] */                    

/* Wait until stop sequence is sent */
while(NRF_TWI1->EVENTS_STOPPED == 0)
{
    // Do nothing.
}
NRF_TWI1->EVENTS_STOPPED = 0;

return true;

}

Any ideas folks?

Mat

Related