2026-03-05 1:46 AM
Hello,
I am currently trying to port the ST25R3916B driver to a platform that uses the ThreadX RTOS, but I am encountering some issues. I have previously ported it to a platform using Zephyr, and that process went smoothly.
I have already implemented the platform-specific files responsible for I2C communication, IRQ handling, and software timers. The initialization process completes without any errors. However, in the main thread—where I call rfalWorker()—the NFC tag is not detected.
Below are some relevant code snippets:
Init()
{
/* Initialize RFAL platform */
rc_st = rfalNfcInitialize();
}Discover()
{
/* Retrieve default discovery parameters */
rfalNfcDefaultDiscParams(&m_discParam);
m_discParam.notifyCb = m_fncPollNotification;
m_discParam.p2pNfcaPrio = true;
m_discParam.totalDuration = 1000;
m_discParam.techs2Find = flags;
m_pollDuration = duration;
ReturnCode rc = rfalNfcDiscover(&m_discParam);
}
while (1)
{
rfalNfcWorker();
state = rfalNfcGetState();
/* Verify if a device was detected */
if (rfalNfcIsDevActivated(state))
{
LOG_MESSAGE("NFC dev detected\n");
m_pollingActive = false;
}
_sleep(10);
}
I printed the IRQ status values on both boards, and they are the same while RFAL is running in the idle state. However, when I tap the phone, the values become different.
I will attach screenshots of the logs (values shown in hexadecimal):
Bbb
Solved! Go to Solution.
2026-03-13 1:37 AM - edited 2026-03-13 5:04 AM
Hi,
we don't have a guide on porting to ThreadX. What you describe sounds like it could be a concurrency problem: Main/task level and interrupt level both executing I2C and not being properly protected. Please review your platformProtect*() macro implementations.
BR, Ulysses
2026-03-06 12:05 AM
Hi JPortilha,
hard to say what actually is happening. It looks like an NFC-A card being received and then some error happening during AntiCollision. The error is not signaled from the NFC chip. I recommend to attach a logic analyzer and trace SPI lines + IRQ. This will allow much more educated suggestions on the root cause.
BR, Ulysses
2026-03-12 10:43 AM
Hello, I got an update:
I am currently working with the STM32WBA65RI and the X-CUBE-NFC6 software package.
I was able to successfully run the provided demo application in bare-metal and detect my smartphone without issues. However, when I enable ThreadX and attempt to run the same demo within the RTOS environment, the application stops working.
Specifically, when the code enters demoCycle(), the system enters in HardFault. The fault appears to occur during the I2CTx() function.
As part of the porting process to ThreadX, I have already replaced time primitives such as HAL_Delay() with tx_thread_sleep(). Despite these changes, the issue persists.
Do you know if additional modifications are required to run X-CUBE-NFC6 with ThreadX? Is there a recommended porting approach or example available for integrating this middleware with an RTOS?
Any guidance would be greatly appreciated.
2026-03-13 1:37 AM - edited 2026-03-13 5:04 AM
Hi,
we don't have a guide on porting to ThreadX. What you describe sounds like it could be a concurrency problem: Main/task level and interrupt level both executing I2C and not being properly protected. Please review your platformProtect*() macro implementations.
BR, Ulysses