2024-06-28 09:00 AM
I'm working on porting the RFAL for ST25R3916B to an nRF5340, using the pairing example for X-NUCLEO-8. I have it all compiling and flashing correctly, but things break down during initialization here:
In rfalInitialize() -> st25r3916Initialize(), the issue occurs when trying to measure voltage with st25r3916MeasureVoltage(). After executing st25r3916ExecuteCommandAndGetResult, I get the below SPI trace. The IRQ line goes high as expected, the RFAL then sends a read request for registers 0x1A through 0x1D, and the ST25R3916B does not respond with any active IRQs and does not clear the IRQ line. This results in a memory access violation on the nRF5340.
This is the standard, unmodified RFAL for ST25R3916/B. The DCT interrupt is enabled. The SPI trace looks exactly the same as a previous IRQ read. Is there something different about the Measure Power Supply (0xDF) command? Any help would be appreciated.
Solved! Go to Solution.
2024-07-01 01:08 PM
Hi,
make sure your platformProtectST25RComm/platformUnprotectST25RComm implementation is correct. Basically a SPI ongoing transfert shall not be interrupted by another SPI transfer (e.g. reading the interrupt register). An easy way is to disable the interrupt from the ST25R3916B during a given SPI transfer. On STM32 MCU where the ST25R3916B interrupt line is connected to PA0 GPIO, NVIC_DisableIRQ(EXTI0_IRQn)/NVIC_EnableIRQ(EXTI0_IRQn) is used to temporally suspend and then reenable the interrupt on PA0. A similar mechanism has to be ported to your own MCU.
Rgds
BT
2024-07-01 01:20 AM
Hi,
can you enable the ST25R_SELFTEST switch and provide the Salae raw file?
Many thanks
Rgds
BT
2024-07-01 01:52 AM
Hi,
to me it looks there is no CS transition before sending the Read Interrupt status reg command:
Br, Ulyssses
2024-07-01 06:08 AM
Here's the log file, it looks like the self test completes without any issues.
I hadn't noticed what Ulysses pointed out; no CS transition after the command may very well be the issue. My CS deselect port doesn't fail anywhere else, but I'm going to try a different method just in case.
2024-07-01 06:09 AM
2024-07-01 07:44 AM
Hi,
csv is hard to read, better share the original Saleae file inside a zip.
The missing CS positive pulse is highly likely the reason for the Interrupt status register read not being correctly executed.
Ulysses
2024-07-01 12:56 PM
Hi Ulysses,
I think you're right, but it's not (directly) about the missing CS positive pulse. Here's where I'm at:
During step 3, the SPI peripheral attempts to put the 0x83 into a nullptr, causing a memory access exception. What I don't understand is why the next four 0xFFs were sent, as the host should have already crashed.
The .sal is attached. .zip and .sal aren't allowed, so I changed the extension to .log. Just change it from .log to .sal and it should open fine.
2024-07-01 01:08 PM
Hi,
make sure your platformProtectST25RComm/platformUnprotectST25RComm implementation is correct. Basically a SPI ongoing transfert shall not be interrupted by another SPI transfer (e.g. reading the interrupt register). An easy way is to disable the interrupt from the ST25R3916B during a given SPI transfer. On STM32 MCU where the ST25R3916B interrupt line is connected to PA0 GPIO, NVIC_DisableIRQ(EXTI0_IRQn)/NVIC_EnableIRQ(EXTI0_IRQn) is used to temporally suspend and then reenable the interrupt on PA0. A similar mechanism has to be ported to your own MCU.
Rgds
BT