2022-01-19 05:32 PM
We are communicating with the st25r3916 chip normally.
But after about 14 minutes,
The value of the IRQ pin is maintained at HIGH.
You fall into an infinite loop in the function st25r3916CheckForReceivedInterruptts().
What is the problem ?
please I'd appreciate it if you let me know.
Infinite loop.
while( platformGpioIsHigh( ST25R391X_INT_PORT, ST25R391X_INT_PIN ) )
{
st25r3916ReadMultipleRegisters( ST25R3916_REG_IRQ_MAIN, iregs, ST25R3916_INT_REGS_LEN );
irqStatus |= (uint32_t)iregs[0];
irqStatus |= (uint32_t)iregs[1]<<8;
irqStatus |= (uint32_t)iregs[2]<<16;
irqStatus |= (uint32_t)iregs[3]<<24;
}
Solved! Go to Solution.
2022-01-20 06:26 PM
It's a circuit error. It is currently being used as output.
2022-01-20 06:33 PM
I used the X-NUCLEO-NFC06A1 example.
Everything you said...
It is implemented in platform.h.
But in the IRQ handler
void EXTI9_5_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_5_IRQn 0 */
BSP_SPI1_IRQHandler();
/* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
/* USER CODE END EXTI9_5_IRQn 1 */
}
If you do not implement this, you will not communicate with st25r3916.
The example is also implemented as follows.
void EXTI0_IRQHandler(void)
{
BSP_SPI1_IRQHandler();
}
2022-01-20 06:37 PM
The code is adapting.
The end goal is to drive 2 chips.
2022-01-21 02:00 AM
Hi,
I had a look to your EXTI9_5_IRQHandler code and in my opinion this can cause some side effect: if a new interrupt is triggered just after line #4, it will be cleared by the HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8); in line #6 of the code snippet. Therefore I would recommend the following implementation:
void EXTI9_5_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_5_IRQn 0 */
/* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
st25r3916Isr();
/* USER CODE END EXTI9_5_IRQn 1 */
}
Note: make sure to #include "st25R3916_irq.h" to avoid compiler warning.
Can you also double confirm that:
Rgds
BT
2023-10-06 08:54 AM
Hi,
I have exactly same issue with ST25R3916... I've already try the fix proposed but nothing changed.
Is there any update about this issue ?
Thanks in advance,
BR
2023-10-06 01:41 PM
Hi,
can you share more details about your setup:
Can you connect a logic analyzer on the SPI (CLK/MISO/MOSI/SS) + ST25R3916_IRQ and provide a trace?
Rgds
BT
2023-10-09 01:23 AM
Hi,
I have also USB CDC communication. It's looks like USB, after a while, disturb the ST25R3916 IRQ management... But im not sure.
For the moment, i dont have any trace or SPI logic analyze.
Thanks
Best regards
2023-10-09 02:34 AM
Hi,
if calls to the STM32 HAL are done inside the USB IRQ handler or inside the ST25R3916 IRQ handler (which is actually the case), the SYSTICK interrupt priority has to be higher than the USB or ST25R3916 interrupts. This is because the STM32 HAL has some active wait loops (e.g. SPI_WaitFlagStateUntilTimeout) based on tick being incremented by the SYSTICK handler.
I would suggest to check the priorities of the various interrupts as I suspect a deadlock.
Regarding the priorities: The lower the number, the higher the priority, which means a priority of 0 is the highest priority an external interrupt can have.
Rgds
BT
2023-10-09 08:02 AM
Hi,
I've tried to change priority of EXTI0 and USB to 1 but same issue appears...
Maybe i have to change tick implementation in platform.h with a hardware timer ?
I think you're right it's a deadlock but i cant find why it's happend...
Best regards
2023-10-09 09:24 AM
Hi,
using the debugger, can you try to break execution while the system is stuck and have a look to where the execution is. If the execution is inside hard fault handler, it is likely a crash (stack overflow, etc.). If the execution is around HAL_Delay() or HAL_GetTick(), it is likely a deadlock.
No need to use HW timer, this should work with the Systick. By the way, what is the priority of the SYSTICK interrupt?
Rgds
BT