cancel
Showing results for 
Search instead for 
Did you mean: 

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

cGosa.1
Senior

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

21 REPLIES 21
Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Ulysses HERNIOSUS
ST Employee

Hi,

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

Regards, Ulysses

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

Brian TIDAL
ST Employee

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

 

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Ulysses HERNIOSUS
ST Employee

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

Screenshot (214).png

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

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.

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

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?