2025-10-10 9:03 AM - edited 2025-10-10 9:04 AM
Hi,
I am using this library on Rpi5:
https://www.st.com/en/embedded-software/stsw-st25r021.html#overview
I modified the gpio_init thusly
stError gpio_init(void)
{
    int ret = 0;
    char gpiochip_file[SIZE];
    if (isGPIOInit) {
        return ERR_NONE;
    }
    sprintf(gpiochip_file, "/dev/gpiochip4"); /* Open /dev/gpiochip0 */
    int fd = open(gpiochip_file, O_RDONLY);I modified the rfal_platform.h to correspond to my interrupt pin
/* Set the GPIO pin number used as interrupt line to receive interrupts from ST25R */
#define ST25R_INT_PIN               12                     /*!< GPIO pin used for ST25R External Interrupt         */
#define ST25R_INT_PORT              (fd_GPIOs[0])         /*!< But the demoIni function fails (I added some debug statements)
    bool ok = demoIni();
printf("debug1, demoIni result %d\n", ok);    
    while ((!ok) || (ok && i--))
    {
        platformLedOn(PLATFORM_LED_FIELD_PORT, PLATFORM_LED_FIELD_PIN);
        platformLedOn(PLATFORM_LED_A_PORT, PLATFORM_LED_A_PIN);
        platformLedOn(PLATFORM_LED_B_PORT, PLATFORM_LED_B_PIN);
        platformLedOn(PLATFORM_LED_F_PORT, PLATFORM_LED_F_PIN);
        platformLedOn(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
        platformLedOn(PLATFORM_LED_AP2P_PORT, PLATFORM_LED_AP2P_PIN);
        platformDelay(ok ? 200U : 100U);
        platformLedOff(PLATFORM_LED_FIELD_PORT, PLATFORM_LED_FIELD_PIN);
        platformLedOff(PLATFORM_LED_A_PORT, PLATFORM_LED_A_PIN);
        platformLedOff(PLATFORM_LED_B_PORT, PLATFORM_LED_B_PIN);
        platformLedOff(PLATFORM_LED_F_PORT, PLATFORM_LED_F_PIN);
        platformLedOff(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
        platformLedOff(PLATFORM_LED_AP2P_PORT, PLATFORM_LED_AP2P_PIN);
        platformDelay(ok ? 200U : 100U);
    }
printf("debug2\n");
It obviously hangs within the while cycle as seen in the output:
sudo ./nfc_demo_st25r200 
Welcome to the ST25R NFC Demo on Linux.
debug1, demoIni result 0I checked my wiring three times, I use the SPI0 which should be the default in the demo.
Any ideas why it's not working?
All the best,
Michael
Solved! Go to Solution.
2025-10-16 4:21 AM
Thanks Brian,
the final problem was that the 5V pin from rpi5 was insufficient to power tha 09A1. An external 5V power supply solved the issue. Thanks for all the suggestions!
Best regards,
Michael
2025-10-10 11:06 AM
Hi,
Could describe your hardware setup? e.g. X-NUCLEO-NFC09A1 + interposer (ARPI600) or flying wires? Could you check that the ST25R100 reset pin is tied to Gnd.
Make sure to follow the various recommendations from User Manual UM3559.
Could you enable the ST25R_SELFTEST compilation switch to check the communication interface and the interrupt handling? Also I suggest to set a breakpoint in st25r200Initialize and step in.
Rgds
BT
2025-10-15 5:16 AM - edited 2025-10-15 5:41 AM
Could describe your hardware setup? e.g. X-NUCLEO-NFC09A1 + interposer (ARPI600) or flying wires?
X-NUCLEO-NFC09A1 + flying wires
Could you check that the ST25R100 reset pin is tied to Gnd.
I did.
Make sure to follow the various recommendations from User Manual UM3559.
I did. There's actually a mistake in the manual - "the platform specific code (in
file pltf_gpio.h) must be modified to change the definition of macro ST25R_INT_PIN from 7 to the new GPIO pin,"
The correct file is rfal_platform.h, not pltf_gpio.h.
Could you enable the ST25R_SELFTEST compilation switch to check the communication interface and the interrupt handling?
I did: cmake -DBUILD_SELFTEST=ON ..
But it dies here, even before it gets to the SELFTEST section:
    if( !st25r200CheckChipID( NULL ) )
    {
        platformErrorHandle();       
        return RFAL_ERR_HW_MISMATCH;
    }EDIT: it always gives me ID == 0 inside st25r200CheckChipID().
 I checked my spi communication by connecting MISO to MOSI and I get correct results:
sudo ./spidev_test -D /dev/spidev0.0 -s 500000 -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
2025-10-15 2:28 PM
Hi,
"It always gives me ID == 0 inside st25r200CheckChipID()." This indicates that no data has been received on the MISO line, which the SPI controller interprets as zeroes. Several potential causes include:
The device is not properly powered:
Reset pin issues:
Inverted SPI MISO and MOSI:
Missing or incorrectly driven SPI BSS:
I recommend connecting a logic analyzer to the SPI lines (CLK, MISO, MOSI, BSS) and the ST25R_INT pin. You can share the raw file from your logic analyzer for further analysis.
Regards,
BT
2025-10-16 4:21 AM
Thanks Brian,
the final problem was that the 5V pin from rpi5 was insufficient to power tha 09A1. An external 5V power supply solved the issue. Thanks for all the suggestions!
Best regards,
Michael
2025-10-16 4:31 AM
Hi Michael,
thanks for your feedback. Good to know that some RPi5 may have insufficient supply for some add-on expansion board.
Rgds
BT
