cancel
Showing results for 
Search instead for 
Did you mean: 

Spi clocks are 4, 5, 6 instead of 8 bits

dorong
Associate II

Hi all
I am using the stm32h743 device when using spi 6 to transmit data the clocks
are 4, 5, 6 randomly instead of 8 bits
when configuring spi2 the processor function perfectly.
on this device I have already used 
connection: SPI1, SPI5, ethernet, uart4.uart7,uart8, usart1,usart2,usart3
middleware and software package: freertos, LWIP
Timers: Timer1
System core: DMA, GPIO,NVIC, RCC, SYS
CubeMx Version 6.13
CubeIDE 1.16.0
Repository: 1.12.0

Thank you for you answer

10 REPLIES 10
TDK
Guru

Show the contents of the SPI6 registers at the time of the error. Logic analyzer trace showing the issue would be good as well.

If you feel a post has answered your question, please click "Accept as Solution".

Make sure to clear and populate the SPI Initialization / Instance structure completely.

By default auto/local variables will contain stack junk unless explicitly cleared, and random things can happen.

{
  SPI_HandleTypeDef SpiHandle = {0};
...

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dorong
Associate II

bad spi 5 bits on spi6bad spi 5 bits on spi6good spi 8 bits on spi2good spi 8 bits on spi2

i did it. this did not helped

Bad_spi_parameers.JPG

TDK
Guru

My guess is you're disabling the peripheral too early. Possibly when DMA completes but before the transaction completes. The SPI6 registers would be in the SPI6 instance, not the hspi6 handle.

In any case, your "8 good bits" are certainly not. Look at the clock line. There are 7 clocks plus a spurious edge/pulse on what should be the start of the 8th.

Showing the relevant code would be useful.

If you feel a post has answered your question, please click "Accept as Solution".
dorong
Associate II

I have created only SPI 6 software to check if other resources damages spi6
but found that the same random clocks appears 4,5,6 clocks instead of 8
I have also configured spi2 exactly the same but SPI 2 clocks function perfectly. 

 

my friend I have me reason why it is like that. thank you for your suggestions.