I am trying to use nfc_t4t_lib in NFC_T4T_EMUMODE_PICC mode. After receiving an APDU I am doing some calculations and sending reply with nfc_t4t_response_pdu_send. If calculations take some time, I am getting NRF_ERROR_INVALID_STATE as a result.
I have some questions:
- How can I enable some extra debugging or logging to find out a reason for NRF_ERROR_INVALID_STATE error.
- Can it be caused by too low FWI value? It seems that maximum value supported by the lib is 4, which corresponds to some ~5ms timeout. When calculation takes longer than 5ms, I am getting NRF_ERROR_INVALID_STATE error.
- Does nfc_t4t_lib support sending S(WTX) blocks to extend the timeout?
Here is the code I am talking about:
static void nfc_callback(void * context,
nfc_t4t_event_t event,
const uint8_t * data,
size_t dataLength,
uint32_t flags)
{
switch (event)
{
case NFC_T4T_EVENT_FIELD_ON:
bsp_board_led_on(BSP_BOARD_LED_0);
break;
case NFC_T4T_EVENT_FIELD_OFF:
bsp_board_leds_off();
break;
case NFC_T4T_EVENT_DATA_IND:
if ((flags & NFC_T4T_DI_FLAG_MORE) == 0)
{
nrf_delay_us(6 * 1000); // do some work
err_code = nfc_t4t_response_pdu_send(resp, resp_len);
APP_ERROR_CHECK(err_code); // err_code = 8
}
break;
}
}