cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R3916B Initialization Issue on Nucleo-h563ZI (Zephyr) - MISO always reads 0x00

htar00
Visitor

Hello,

I am currently working on initializing ST25R3916B (X-NUCLEO-NFC08A1) with Nucleo-H563ZI microcontroller, using the Zephyr RTOS and the zephyr-st25r driver.

My primary goal is to successfully initialize the ST25R3916B chip to a state where it can respond to basic SPI commands and eventually perform NFC operations.

I am encountering an issue during the initialization phase where the STM32 appears to be correctly sending write and read commands via SPI, but the MISO line consistently reads 0X00 , indicating that the ST25R3916B is not responding or not driving the MISO line with expected data.

Hardware Setup:

This is the content my overlay file: 

/ {
chosen {
zephyr,spi-st25r3916 = &st25r3916_nfc;
};
};

&spi1 {
pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pg9 &spi1_mosi_pb5>;
pinctrl-names = "default";
status = "okay";
st25r3916_nfc: st25r3916@0 {
compatible = "st,st25r";
reg = <0>;
spi-max-frequency = <4000000>;
irq-gpios = <&gpiog 14 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpiod 14 GPIO_ACTIVE_LOW>;
status = "okay";
};
};

For the physical hardware connections:

CN5(PIN5) -> SCK (D13)

CN5(PIN6) -> MISO (D12)

CN5(PIN7) -> MOSI (D11)

CN5(PIN8) -> CS (D10)

CN8(PIN1/MCU_IRQ) -> D2 

CN6(PIN4) -> 3.3V

CN6(PIN6) -> GND

 

Software Setup:

RTOS: Zephyr (version: 4.1.99)

ST25R Driver: Utilized the zephyr-st25r driver from the Zephyr project. (https://github.com/ptournoux/zephyr-st25r/tree/main)

SPI Configuration: Mode: SPI Mode 1

I did some modifications to the driver especially st25r3916Initialize function in st25r3916.c and the st25r_spi.c file too. I'll attach the function modifications and st25r_spi.c file. I'll also attach a section of my output log below.Are there any common hardware-related pitfalls with the ST25R3916B that would cause it to not drive MISO, even if power and crystal seem okay? or could it be a software issue?

Thank you in advance

1 REPLY 1
Ulysses HERNIOSUS
ST Employee

Hi,
for register access no crystal is needed. For being able to access registers it only needs power. Additionally when using SPI it also needs a proper setting of I2C_EN pin. Please check this point.

If this does not help then look at the signals if indeed CS, SCLK and MOSI are coming out as expected. 

They try to read IC Identity register (Address 0x3f. Two byte SPI frame starting with 0x7f at MOSI).

If you see the data on MISO but not in MCU then there should be some issue in SPI configuration.

If you don't see the data on MISO (or only weakly) then GPIO config of MCU might be incorrect. 

Ulysses