cancel
Showing results for 
Search instead for 
Did you mean: 

X-NUCLEO-NFC08A1 with Linux Demo on Raspberry fails with SPI and I2C

pfpgio
Associate II

Hello everyone! I have difficulties to run the 2.8.0 Linux Demo (the latest one) the X-NUCLEO-NFC08A1 with the ST25R3916B on Linux/Raspberry both with SPI as well as the less oftendused I2C. I don't have the interface board "ARPI600" to interface the Nucleo to the RPi, so I've made a manual connection. I have tried two different Rasperries (very old RPi 1 and a modern RPi 2 Zero W), with SPI and I2C, yet no success with either connection method with both RPIs. 

I am providing +3.3 and 5V from the Rasperry to CN6, PowerLED on the Nucleo is on.

I checked after all my failed trials - others did make it the same way:
https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/st25r3911b-disco-to-raspberry-pi-not-working-using-same/m-p/228869 

I am using the same mapping to the RPi pin header. Raspberry Pi Zero (latest Bullseye, Kernel 6.1.21-v7+ ) where "raspinfo" shows the SPI and I2C settings.

GPIO 2: level=1 fsel=4 alt=0 func=SDA1
GPIO 3: level=1 fsel=4 alt=0 func=SCL1

GPIO 7: level=0 fsel=0 func=INPUT
GPIO 8: level=1 fsel=1 func=OUTPUT
GPIO 9: level=0 fsel=4 alt=0 func=SPI0_MISO
GPIO 10: level=0 fsel=4 alt=0 func=SPI0_MOSI
GPIO 11: level=0 fsel=4 alt=0 func=SPI0_SCLK

I2C works with other devices.

GPIO 7/CE-1 is set in the boot/config.txt according to readme from the Linux driver: "dtoverlay=spi0-1cs".
I have set the solder bridge / 0 Ohm connector on the Nucleo for I2C_Enable accordingly to the case.

"sudo ./nfc_demo_st25r3916b"

"Welcome to the ST25R NFC Demo on Linux.
Scanning for NFC technologies..."

and stops in the loop with the LED on/blinking.

### I2C

If I switch to I2C, compile with the I2C-Flag, I2C_EN against VDD_D and 56k Pull-Ups on SDA and SCL (doesn't make a difference).
RPI-I2C boot-seeting settings from readme "core_freq = 250" and "dtparami2c_arm=on i2x_arm_baudrate=400000


"sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --"

The ST25R3916B is found on the I2C bus, which looks promising, yet


"Welcome to the ST25R NFC Demo on Linux.
Scanning for NFC technologies...
Open i2c bus /dev/i2c-1 for nfc successful
Set slave address of the sensor /dev/i2c-1 to (0x50) successful"

Again, after initialization it's stuck and the LEDs go on.

The LEDs indicate a problem with RFAL init. I don't have a logic analyzer here for further SPI debugging but since I2C is functional and found the ST25R3916B  in combination with the LEDs on I can't help to think it's more of a driver/library problem...

Any ideas?

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
pfpgio
Associate II

Thanks Ulysses! I found the problem. It was an electrical one. The antenna connection had a cold soldering joint...

View solution in original post

6 REPLIES 6
Ulysses HERNIOSUS
ST Employee

Hi,

please debug into the initialization to see where it chokes. My first guess would be that you forgot to set ST25R3916B compile time flag. Likely by default it is compiling for ST25R3916 and then returns an error on finding an incorrect chipID. 

Regards, Ulysses

- Double post - see below

 

pfpgio
Associate II

Hi Ulysses! No, unfortunately not.

I have tried intentionally even to compile with the non-B version and it fails in line 178 of the main.c. If I disconnect IRQ it also fails early on. As one might expect.

Compiled for the ST25R3916B it proceeds into the following loop of demoCycle. Original file main.c line 196. I have added to this code some platformLog-outputs to easier read errors:


while(1)
{
platformLog("demoCycle start: \r\n");
demoCycle();

uint32_t delay = demoGetUsSleepDuration();

ts_delay.tv_sec = delay / US_TO_SEC;
ts_delay.tv_nsec = (delay % US_TO_SEC) * US_TO_NS;

/* Lock Semaphore to suspend this thread */
clock_gettime(CLOCK_REALTIME, &sem_time);

add_time(&sem_time, &ts_delay, &new_time);

int err = sem_timedwait(&rfal_sem, &new_time);
platformLog("sem_timedwait error %d errno %d\r\n", err, errno);

//platformLog("After err_sem.\r\n");
if ( (err != 0) && (errno != ETIMEDOUT) ) {
platformLog("###### In error.\r\n");
platformLog("sem_timedwait error %d errno %d\r\n", err, errno);
}
platformLog("demoCycle ends: \r\n");
}


which delivers the following:


demoCycle start:
sem_timedwait error 0 errno 0
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 0
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 0
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 0
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 0
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error -1 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:
sem_timedwait error 0 errno 110
demoCycle ends:
demoCycle start:

So, there is a timing problem with the semaphore apparently ?!

pfpgio
Associate II

Add on: I have tested with I2C - same results as above: timeout error 0/-1 flip.

If I disconnect SDA, SCL it drops I2C errors (as expected) and if IRQ gets disconnected it fails at init or stops in the cycle. 

Is there any simple way to debug if the chip is broken?

 

Hi,

what does make you think the application is not working? Normal behavior when there is no tag is in proximity is just to sit waiting for NFC tags. I think it will blink indicating the field getting turned on and off. 

BR, Ulysses

pfpgio
Associate II

Thanks Ulysses! I found the problem. It was an electrical one. The antenna connection had a cold soldering joint...