2026-01-27 4:48 AM - last edited on 2026-01-27 5:11 AM by Andrew Neil
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 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:
Edited to apply source code formatting - please see How to insert source code for future reference.
2026-01-27 5:16 AM
@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...
2026-01-27 5:42 AM
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.
2026-01-27 5:55 AM - edited 2026-01-27 5:56 AM
Hi,
besides twisting and putting wires 90 degrees away from the antenna:
Best Regards, Ulysses
2026-01-27 7:04 AM
Thank you for help. I enabled the Glitch filter and the peaks are gone:
I also checked the CS line with the scope:
2026-01-27 7:07 AM
Also, when i short MOSI and MISO, the MCU is able to read the loopback communication
2026-01-27 7:14 AM
Please perform analog signal integrity on MISO line: Record at least two lines, best SCLK and MISO together to see the level on MISO when it should be driving a value.
2026-01-27 7:22 AM
Your scope has a USB socket for screen captures:
Please use it - it will give much better results than photographs!
(I'm sure you can also do it via the LAN connection)
2026-01-27 7:24 AM
@qwdwdwwq wrote:Thank you for help. I enabled the Glitch filter and the peaks are gone:
Of course - the whole point of a glitch filter is to filter-out glitches!
But that only filters them out from the LA display - it doesn't do anything to clean-up the actual signals on the board.
2026-01-27 7:32 AM
Yellow MOSI
Blue MISO
Purple SCK