cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing an SSI slave interface on STM32 Board

I am trying to implement a SSI Slave Protocol on a STM32 Board. Since the STM32 Boards don't have a SSI interface, I used its SPI interface in Slave(Transmit only mode). The master SSI sends 24 clock signals and the slave reacts by sending its data(3 Bytes) over the MISO pins. The problem I am facing is that the data is always shifted on the left on every clock signal coming from the master. For example assuming I am constantly sending 0x010101 from slave.

  • At first transmission the master receives 0x010101
  • At Second transmission the master receives 0x020202
  • At third transmission the master receives 0x040404

Can someone please give me some hints on how to solve this problem?

1 ACCEPTED SOLUTION

Accepted Solutions

> I think data can only be sent in blocks of 8Bit.

0693W000001scWcQAI.png

I don't say it's practical, though.

JW

View solution in original post

7 REPLIES 7

What is SSI?

JW

https://en.wikipedia.org/wiki/Synchronous_Serial_Interface ?

After the transmission of complete data word (3) (i.e. LSB is transmitted), an additional rising edge of the clock sets the clock line HIGH.

In other words, the transfer is effectively 25-bit, for 24-bit data.

You did not tell us which STM32 are you using, but you can probably reset the SPI's internal bit counter by disabling it (SPE=0) and reenabling it again.

Alternatively, send truly 25 bits of data.

JW

Thank you for your reply, I am using STM32F042k6. Yes you are right the transfer is effectively 25-bit for 24-bit data. I think data can only be sent in blocks of 8Bit. So it will practically impossible to send 25Bit data. I will try to disable the internal bit counter if available. Thanks again

> I think data can only be sent in blocks of 8Bit.

0693W000001scWcQAI.png

I don't say it's practical, though.

JW

Thanks so much I will try it and give you a Feedback.

@Community member​  Thanks it works.

Jcer
Associate

Hi, I am implementing an SSI slave protocol to emulate a magnetic encoder and in my current application the motor controller (SSI master) sends a clock signal up to 10Mhz. I wonder how fast you were able to get you slave to work.