2023-06-22 01:52 AM - last edited on 2023-06-22 02:12 AM by Peter BENSCH
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.
Solved! Go to Solution.
2023-07-19 01:51 AM
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.
2023-06-22 04:16 AM - edited 2023-06-22 04:18 AM
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
2023-06-22 05:56 AM
Hi,
does EXIT_ON_ERR() really hang? The implementation inside I think utils.h should be return from current function.
Regards, Ulysses
2023-06-27 02:59 AM
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.
2023-06-27 04:07 AM
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
2023-06-27 04:45 AM
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
2023-06-27 04:57 AM
As mentioned the configuration is made in SPI and in logic analyzer, this is the picture with signal names
2023-06-27 05:28 AM
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.
2023-06-27 05:51 AM
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
2023-06-28 11:07 PM
Hello,
I have configured the SPI settings as mentioned .Currently my code is getting stuck at st25r3916CheckChipID() function and its returning hw mismatch error.
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;
} This condition is getting satisfied.
Actually i have just added the #define ST25R3916B macro in platform.h file is it enough to select the 3916b IC or any register changes are required can you please suggest?