Skip to main content
Associate II
January 27, 2026
Solved

ST25R3911B SPI issues

  • January 27, 2026
  • 4 replies
  • 472 views

Hello,

I got back to my issues from this post.

I was able to connect wires to SPI lines, and get the measurements to logic analyzer. These are the results:

Logic2 screenshotLogic2 screenshot

 

Now i can see that the issue is the CS line, but i dont know why it is being changed to HIGH in these short pulses. 

 

The GPIO config:

 
/*Configure GPIO pin : SPI1_CS_Pin */
GPIO_InitStruct.Pin = SPI1_CS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(SPI1_CS_GPIO_Port, &GPIO_InitStruct);

SPI Config:

hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
 

 

And the PCB Traces:

qwdwdwwq_0-1769517959549.png


Edited to apply source code formatting - please see How to insert source code for future reference.

This topic has been closed for replies.
Best answer by Brian TIDAL

Hi,

There is no activity on the MISO signal. Check that there is no external pull-up resistor or microcontroller internal pull-up enabled. Verify that the MOSI and MISO signals are not swapped. Also, check that the ST25R3911B device is properly powered. Feel free to share your schematics (in private if you prefer).

 

Check:

BrianTIDAL_0-1769529452819.png

versus:

BrianTIDAL_1-1769529494764.png

P and N seem to be swapped...

Rgds

BT

4 replies

Andrew Neil
Super User
January 27, 2026

@qwdwdwwq wrote:

Now i can see that the issue is the CS line, i dont know why it is being changed to HIGH in these short pulses. 

Not just CS - it's also on MOSI

Looks like noise being picked up; try looking at it with your scope - in the analogue domain.

 

What's with the wiggly bits on the SPI traces?

One wouldn't usually worry about equal trace lengths on SPI, but it does look like a good way to pick up interference...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Brian TIDAL
Technical Moderator
January 27, 2026

Hi,

This issue may be caused by crosstalk in the logic analyzer probe cables.

To reduce crosstalk between wires, twist each signal wire with a ground wire, or at least twist the critical signal wires, such as CS and CLK, with a ground wire.

Ensure that the digital input/output voltage is set correctly, as this setting also adjusts the input logic threshold, which is approximately half of the VIO value.

If the issue still occurs, follow the suggestion from Andrew and use a scope.

Rgds

BT

 

P.-S. feel free to attach the Salae file in your answer.

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
Technical Moderator
January 27, 2026

Hi,

besides twisting and putting wires 90 degrees away from the antenna:

  • Incorrect SPI config in Saleae. Correct one here:
     UlyssesHERNIOSUS_0-1769521802251.png

     

  • Enable Glitch filter in Saleae: 
    UlyssesHERNIOSUS_1-1769521859519.png

     

  • Looking at raw (ignoring the noise): MOSI shows correct 7F (read IC ID) but no activity on MISO
    -> Maybe MISO pin not correctly configured from MCU side? You could open MISO line on MCU side and observe.

Best Regards, Ulysses

qwdwdwwqAuthor
Associate II
January 27, 2026

Thank you for help. I enabled the Glitch filter and the peaks are gone:

Screenshot from 2026-01-27 15-51-01.png

 I also checked the CS line with the scope:

20260127_160051.jpg

 

 

qwdwdwwqAuthor
Associate II
January 27, 2026

Also, when i short MOSI and MISO, the MCU is able to read the loopback communication

Brian TIDAL
Brian TIDALBest answer
Technical Moderator
January 27, 2026

Hi,

There is no activity on the MISO signal. Check that there is no external pull-up resistor or microcontroller internal pull-up enabled. Verify that the MOSI and MISO signals are not swapped. Also, check that the ST25R3911B device is properly powered. Feel free to share your schematics (in private if you prefer).

 

Check:

BrianTIDAL_0-1769529452819.png

versus:

BrianTIDAL_1-1769529494764.png

P and N seem to be swapped...

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.
qwdwdwwqAuthor
Associate II
January 28, 2026

Yes, that is the issue. Thanks everyone for help