I'm trying to port this library to ESP32. I'm using NxpNfcRdLib_05.07.00_20170824 version and latest esp-IDF.
First I try to compile and run MifareClassic example. I've added definitions for all GPIO, interupts, and SPI and timers and most of this seems to works now, but still cant run this example.
The problem now is that example pass initialization, and start to pool for tags but hangs when waits for IRQ:
statusTmp = phOsal_EventPend((volatile phOsal_Event_t * )(&pDataParams->HwEventObj.EventHandle), E_OS_EVENT_OPT_PEND_SET_ANY, PHOSAL_MAX_DELAY,
(E_PH_OSAL_EVT_RF | E_PH_OSAL_EVT_ABORT), &tReceivedEvents);
I assume this function waits for event, and this event should come from IRQ. On the console (and logic analyzer) I see IRQ occurs but event probabily don't go to the function above. But I don't see any connection between IRQ and events, there is no callback to define for IRQ events in other implementation so I have no idea how to fix this.
But this problem can come from few things:
- if you run application on ESP32 + ESP-IDF you are using FreeRTOS build in this SDK, and it is different version (8.2) than FreeRTOS provided with NFC libs.
In phOsal_Freertos.c file I need to repleace:
Because in thins version this function doesn't take any arguments.
- I also temporary define function xPortIsInsideInterrupt() because it was missing in portmacro.h and it always return 0 - I know it is wrong but I don't know it is source of this problems...
I will be grateful for any suggestions to this problem and how IRQ information is passed to the events.