STSW-ST25R-LIB using SPI while in IRQ context
Hello everyone,
in a project we are using the ST25R3916 chip to read RFID cards. To do this we are using the sources of the STSW-ST25R-LIB library. If the ST25R3916 sets its IRQ output, the routine st25r3916isr() is called. In this ISR the interrupt registers are read via SPI.
void st25r3916Isr( void )
{
st25r3916CheckForReceivedInterrupts();
...
}
void st25r3916CheckForReceivedInterrupts( void )
{
...
/* In case the IRQ is Edge (not Level) triggered read IRQs until done */
while( platformGpioIsHigh( ST25R_INT_PORT, ST25R_INT_PIN ) )
{
st25r3916ReadMultipleRegisters( ST25R3916_REG_IRQ_MAIN, iregs, ST25R3916_INT_REGS_LEN );
...
}
...
}As other components can be connected to this SPI bus, no SPI communication is alowed in the context of an interrupt, as otherwise 2 SPI operations can overlap and this can lead to undesirable effects.
How can I get around this problem? Is there some kind of polling mode or how can I move the SPI operation into the context of the main loop?
Thank you for your support!
Best regards,
Andy
