hello,
We are implementing the function of sending/receiving via TWI after wake-up by GPIOTE.
The problem is after wake-up by GPIOTE....
The first TWI transmission/reception does not work. (No specific error is returned... only the waveform cannot be observed from the actual port.)
And in the operating state, TWI transmission/reception works normally from the second GPIOTE signal.
SW configuration is
wake-up by GPIOE -> void bsp_event_handler(bsp_event_t event) -> app_timer_start(m_eventTWI_timer_id, EVENT_TWI_MEAS_INTERVAL, NULL);
void bsp_event_handler(bsp_event_t event) { uint32_t err_code; uint8_t mBLE_Send_check = 0; printf("> bsp_EH "); switch (event) { case BSP_EVENT_ADVERTISING_STOP : printf("> BSP_EVENT_ADVERTISING_STOP\r\n"); break; case BSP_EVENT_KEY_0 : printf("eTouch\r\n"); m_eventTWI_timer_cnt = 0; err_code = app_timer_start(m_eventTWI_timer_id, EVENT_TWI_MEAS_INTERVAL, NULL); APP_ERROR_CHECK(err_code); //err_code = nrf_drv_twi_tx(&m_twi, PIC_TOUCH_ADDR, TWI_reg, sizeof(TWI_reg), false); //PIC_TOUCH_set_mode(); mBLE_Send_check = 1; break; } } static void eventTWI_timeout_handler(void * p_context) { //PIC_TOUCH_set_mode(); //nrf_delay_us(500); m_eventTWI_timer_cnt++; printf("> TWI_tEH %d\n\r", m_eventTWI_timer_cnt); UNUSED_PARAMETER(p_context); if( m_eventTWI_timer_cnt <= 1 ) { read_sensor_data(); } else { //m_eventTWI_timer_cnt = 0; app_timer_stop(m_eventTWI_timer_id); } } static void read_sensor_data() { m_xfer_done = false; uint8_t temp_key = 0; /* Read 1 byte from the specified address - skip 3 bits dedicated for fractional part of temperature. */ ret_code_t err_code = nrf_drv_twi_rx(&m_twi, PIC_TOUCH_ADDR, &m_PIC_Touch_data[0], sizeof(m_PIC_Touch_data) ); APP_ERROR_CHECK(err_code); }
After wake-up, there was no effect even if the Timer delay was greatly increased to 500ms or more.
Please check if the first TWI does not run after wake-up.
-----------------------------------------------------------------------------------------------------------------------------------------------------
Additionally, what was discovered during the experiment was
The role of the PCB that currently runs TWI is peripheral, but the above phenomenon is reproduced when it is not connected to central.
However, when connected to central... the problem of not being able to run TWI the first time above disappears.
It operates normally from the first TWI.