Skip to main content
Visitor II
November 4, 2020
Solved

Can't make ST25R95 example to work in my MCU

  • November 4, 2020
  • 5 replies
  • 1307 views

Hello guys

I'm using the STM32F070CB MCU in a custom board connecting SPI pins and IRQ pins to the MCU and trying to scan for NFC devices. We've tested the board and the ST25R95 with std32duino libraries and we could make it work, but we needed to see UIDs and we could'nt read it in Arduino IDE and changed platform to use STM32CubeIDE.

We have some errors when calling initialize functions, rfalInitialize does return error in st25r95Initialize() (ERR_SYSTEM). IRQ_I and NSS pins have correct signals but I think we're missing something on the configuration.

We think it could have something about USART3, because it shares CTS/RTS and SCK/MISO pins from SPI2, but we couldn't figure it out.

Thanks in advance

Arthur Käfer

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    if you can plug a logic analyzer on the SPI, it would help to analyze the issue.

    I've attached my STM32CubeMX ioc file so that you can compare. For SPI, make sure to have Full Duplex Master, Hardware NSS Disable, 8 bits/Moto/MSB first, CPOL Low, CPHA Edge, NSS Signal type: software.

    Rgds

    BT

    5 replies

    Technical Moderator
    November 4, 2020

    Hi,

    ERR_SYSTEM in st25r95Initialize() means that after the startup sequence, the MCU fails to properly receive an answer to the echo command after 5 attemps. This basically means that the SPI communication fails. Can you plug a logic analyzer on SPI (including CS) + IRQ_IN + IRQ_OUT + SSI_0 + SSI_1 and send me the log?

    Also, make sure that.

    • SSI_0=1 and SSI_1=0
    • the ST25R95 is properly powered
    • the 27.12 MHz is properly oscillating

    Thanks

    Rgds

    BT

    AKäfe.1Author
    Visitor II
    November 5, 2020

    We can't plug a logic analyzer right now because it's hard to access the SPI pins, but we can provide some informations I got from the oscilloscope that you requested:

    • SSI_0 is forced to 3V3 and SSI_1 is grounded, directly from our board;
    • ST25R95 is properly powered (3.28V);
    • 27.02MHz measured on the oscillator.

    I don't understand how I made it work on the other platform and on Cube I can't make it work. Is there a specific SPI configuration I have to make in CubeMX to make it work?

    AKäfe.1Author
    Visitor II
    November 5, 2020

    Actually, we have access to the SPI pins (my bad), is it useful to measure them in the starting routine and pass the results for you?

    As a starting point, we have this (no pull-up/pull-down configuration on Cube, just hardware pulled):

    • SPI1_MISO: 3.3V
    • SPI1_MOSI: 0V
    • SPI1_SCK: 0V
    • SPI1_SS: 3.3V

    0693W000005AShcQAG.png 

    Measuring the IRQ_IN pin, we see it pulsing to 0 in the commandEcho function, but the error is the same.

    Technical Moderator
    November 5, 2020

    Hi,

    if you can plug a logic analyzer on the SPI, it would help to analyze the issue.

    I've attached my STM32CubeMX ioc file so that you can compare. For SPI, make sure to have Full Duplex Master, Hardware NSS Disable, 8 bits/Moto/MSB first, CPOL Low, CPHA Edge, NSS Signal type: software.

    Rgds

    BT

    AKäfe.1Author
    Visitor II
    November 5, 2020

    Hi,

    We are using this example as a base model for our code, it builds and goes ok, but the error is the same.

    set

    I noted something on the SPI_SS pin while measuring it, during st25r95resetChip (rfalInitialize()), the value on the pin stays on 1, but it should go to 0 when trying to reset it.

    We changed our SPI config to use the same you provided, changing the SPI-SS pin to GPIO to control it correctly. We're noting some changes on the MOSI and MISO pins and it worked without any errors!

    The changes we had to make should be SPI_SS as a GPIO, probably could be baudrate too, we were using it at max speed, and now it is starting without any errors.

    Thanks for the help

    Arthur Käfer