cancel
Showing results for 
Search instead for 
Did you mean: 

SPI gets out of sync

twagner
Associate II
Posted on December 07, 2017 at 16:56

Hello,

I have a problem with the STM32H743.

I have a pluggable SPI connection and the STM32H743 works as a Slave in receive mode.

When I pull and plug the connection the NSS, CLK and Data connections toggles and I get some random data.

After I plug the cable the NSS signal doesn't resynchronises the transmission and I get some Bits from the old transmission and the transmission before.

How can I activate the resynchronisation of the SPI connection with the NSS signal?

I think the same problem will appear when the slave misses a clock or count a clock to much from an disturbance.

Best reguards

Tobi

#stm32h7-spi-sync
3 REPLIES 3
twagner
Associate II
Posted on December 07, 2017 at 17:13

I forgot to say, that the transmission is 16bit long and the Problem appears in interrupt and in dma mode.

For example I send every time following data:

0b1100 1100 1100 1100

before I pull the connection I receive the right data.

After I pull and plug the connection I get for example the flowing data:

0b1001 1001 1001 1001

It seems that the data in the rx shift register didn't get flushed with a high NSS.

The NSS connection is tested and OK

AvaTar
Lead
Posted on December 07, 2017 at 18:12

I have a pluggable SPI connection and the STM32H743 works as a Slave in receive mode.

This might be the problem.

The SPI bus was designed as a simple inter-IC bus, and has noe provisions for interrupted connections.

Spurious pulses could throw your clock count off and produce bit shifts.

And additional 'reset' signal might help, were the master forces a known initial state.

Posted on December 08, 2017 at 10:59

After taking a closer lock at the received data I saw, that the data were shifted by 8 bit (I configured SPI connection to 16 bit).

It seems, that the SPI interface of the mcu only flushes the last 8 bits and not the 8 bits before for the complete flush of the 16 bits.

Using the device in 8bit mode the SPI interface works correctly.

Is there a unknown bug on the h7?

I locked at the errata sheet of stm32h743 and din't found that problem.