Skip to main content
Visitor II
June 22, 2023
Solved

Facing an issue while interfacing st nucleo expansion board NFC08A1 with another microcontroller

  • June 22, 2023
  • 6 replies
  • 6400 views

Hello,

I'm using NFC08A1 Nucleo expansion board. I am trying to interface this board with another renesas microcontroller via SPI.I have connected the expansion board through jumper wires on SPI lines,IRQ,and GND ,VCC.

I'm using RFAL stack for 3916B IC.

Currently I'm facing issue in IC initialisation DemoIni() function, the code is getting stuck at

 EXIT_ON_ERR( err, st25r3916Initialize() ); inside rfalInitialize() function. Can you please suggest how this issue can be solved.

    This topic has been closed for replies.
    Best answer by cGosa.1

    Hi,

    I have checkked the crystal it was soldering issue now i'm able to get interrupt as well.

    For SPI communication i have maintained a flag in spi interrupt until this flag is not set the code is in while loop. so right now the card gets detected sometimes only if i put too many breakpoints but mostly the SPI interrupt TX RX flag is not set from NFC IC so how this issue can be solved.

    I have done this because the maximum baud rate available is 8000000 bps and previously i was not receiving complete data.

    6 replies

    Technical Moderator
    June 22, 2023

    Hi,

    I would suggest to enable ST25R_SELFTEST during compilation and to run step by step st25r3916Initialize: what is the return code?

    Also, connect a logic analyzer on the SPI (CLK/MOSI/MISO/CS) + IRQ: do you see proper response? Feel free to provide the logic analyzer trace.

    Also, check that you have properly define ST25R3916B at compiler level.

    Rgds

    BT

    cGosa.1Author
    Visitor II
    June 27, 2023

    Hello,

    I have checked the error code Its returning ERR_HW_MISMATCH error. I have connected the nucleo board to a custom hardware of renesas micorocontroller and connected via jumper wires for SPI lines and IRQ. Also I'm not able to receive any irq signal.

    Also the code is getting exit after coming on EXIT_ON_ERR( error, rfalInitialize() );

    Code comes till st25r3916CheckChipID function but then directly returns out of the function.Screenshot (213).png

    Technical Moderator
    June 22, 2023

    Hi,

    does EXIT_ON_ERR() really hang? The implementation inside I think utils.h should be return from current function.

    Regards, Ulysses

    Technical Moderator
    June 27, 2023

    Hi,

    if D1 is the MISO signal, then it seems to be always up...

    if D3 is CS signal, then it seems to return high too early...

    Make sure to enlarge the column with the signal name so that we can easily find each signal.

    Check your SPI configuration and connection. Make sure also to power the device on the nucleo board. In Salae, make sure to configure the SPI decoder with CPOL=0 and CPHA=1 (this should as well be the SPI configuration inside your MCU).

     

    Rgds

    BT

     

     

    cGosa.1Author
    Visitor II
    June 27, 2023

    Screenshot (214).png

    As mentioned the configuration is made in SPI and in logic analyzer, this is the picture with signal names

    Technical Moderator
    June 27, 2023

    Hi,

    the driving of CS is obviously incorrect as already hinted by Brian. The chip gets deselected in the middle of a byte. Likely the SPI driver of Renesas returns before having completely finished the transmission. Then the software generated CS going to deselect is too early.

    Just record the checkChipID(), it should have something like 0x7f on MOSI followed by the device ID on MISO.

    Regards, Ulysses

    Technical Moderator
    June 27, 2023

    Hi,

    please be aware that ST25R3916 and ST25R3916B have different device IDS. When using RFAL with ST25R3916B you need to set the define ST25R3916B (and undefine ST25R3916), otherwise it will check against the device id of ST25R3916 and fail.

    Please debug into the code of st25r3916CheckChipID() and see what it reads and what it compares against.

    Regards, Ulysses

    cGosa.1Author
    Visitor II
    June 27, 2023

    Hi,

    I have defined ST25R3916B in platform.h 

    The st25r3916CheckChipID() function returns false value . it enters the st25r3916CheckChipID() function but inside it comes till here,

    #elif defined(ST25R3916B)
    if( ( (ID & ST25R3916_REG_IC_IDENTITY_ic_type_mask) != ST25R3916_REG_IC_IDENTITY_ic_type_st25r3916B ) ||
    ( (ID & ST25R3916_REG_IC_IDENTITY_ic_rev_mask) < 1U ))
    {
    return false;
    }

    It checks first if condition only and comes out of a function.

    cGosa.1Author
    Visitor II
    June 29, 2023

    Hello,

    So currently as per the SPI configuration ,Screenshot (219).pngScreenshot (220).png

    This is the logic analyzer trace

     

    Technical Moderator
    June 29, 2023

    Hi,

    the shots don't show the complete 0x7f frame ( both bytes until SPI-Enable going high again).

    Please also share the trace file as well.

    Ulysses

    cGosa.1Author
    Visitor II
    June 29, 2023

    HI,

    Please find logic analyzer file: nfc_ssb29-6_1.salNfc_29_6_2.sal

    Technical Moderator
    July 19, 2023

    Hi,

    having the oscillator being enabled is mandatory for using the reader mode. Therefore lines 291-294 should not be commented out.

    I would suggest to check that the X-NUCLEO-NFC08A1 board is not broken: can you check on a second board? Can you inspect the Y200 crystal solders? Can you try the board on a NUCLEO-L476RG?

    Can you also check the power supplies on the board (VBUS and 3V3)?

    Rgds

    BT

    cGosa.1AuthorAnswer
    Visitor II
    July 19, 2023

    Hi,

    I have checkked the crystal it was soldering issue now i'm able to get interrupt as well.

    For SPI communication i have maintained a flag in spi interrupt until this flag is not set the code is in while loop. so right now the card gets detected sometimes only if i put too many breakpoints but mostly the SPI interrupt TX RX flag is not set from NFC IC so how this issue can be solved.

    I have done this because the maximum baud rate available is 8000000 bps and previously i was not receiving complete data.