cancel
Showing results for 
Search instead for 
Did you mean: 

SPI interface where slave returns a delayed clock for MISO

Keerthi
Associate III

Hi,

 

I am using differential SPI communication with an STM32G474. The master sends the clock (SCLK) to the slave and data through the MOSI line. However, the slave responds on MOSI using a delayed clock (DCLK), which is derived from the master clock with some delay (DCLK = SCLK*Delay).

This means the master must read from the slave using DCLK instead of SCLK. I’m sure this cannot be handled through the normal SPI peripheral.

Could someone suggest a solution for this scenario?
One idea I had was:

  1. Use another SPI peripheral on the STM32, configure it as a slave, and use the delayed clock (DCLK) from the slave device as the input clock to capture the return data.

Would this approach work, or is there a better method?

 

Thank you in advance

13 REPLIES 13
Andrew Neil
Super User

Please give details of the slave.

Does the device manufacturer give any suggestions on working with standard SPI Masters? It must be a common question!

 


@Keerthi wrote:

the slave responds on MOSI using a delayed clock (DCLK), which is derived from the master clock with some delay (DCLK = SCLK*Delay).


So does the Slave send this DCLK back to the "Master"? ie, is this an actual output signal from the "Slave"?

 


@Keerthi wrote:
  1. Use another SPI peripheral on the STM32, configure it as a slave, and use the delayed clock (DCLK) from the slave device as the input clock to capture the return data.


Certainly sounds like something to try!

 

Or just bit-bang it?

 

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.
AScha.3
Super User

Should work, just try it.

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

Hi @Andrew Neil ,

 

Sorry that is typo. "However, the slave responds on MISO using a delayed clock (DCLK), which is derived from the master clock with some delay (DCLK = SCLK*Delay).

DCLK is copy of of SCLK because of the transceiver and some other components that add delay. So, sampling data with SCLK cause issue for reading data from Slave through MISO. SO DCLK is output from the slave. 

Again, it would help if you just provided details of the slave so we can see for ourselves!

 


@Keerthi wrote:

because of the transceiver and some other components that add delay. 


What transceiver?

Please post the schematic

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.
henry190
Visitor

It sounds like your slave is effectively running its MISO line on a different clock domain than the master’s SCLK, so you’re right that the standard SPI peripheral can’t just “switch clocks” mid-transaction.

Hi,

I cannot post the schematic. But the overall concept is I have to handle data from slave using clock send by it and get the data. 

>>Use another SPI peripheral on the STM32, configure it as a slave, and use the delayed clock (DCLK) from the slave device as the input clock to capture the return data.

 

That was my initial thought. uSart synchronous mode might be an option, and if not too fast, one might be able to used EXTI or TIM Input Capture

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

Hi @Tesla DeLorean 

 

Thanks for the reply. The SPI runs at high frequencies that is 60MHz. I don't think USART works

TDK
Super User

This is not differential signaling. Sounds much more like "delayed".

Differential signalling - Wikipedia

 

Yes, a separate slave SPI instance will work to receive data.

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