cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Communication with Peripherals in Different Modes (Mode 0 & Mode 1)

Spdkalyan
Associate

Good afternoon Team,

I am working on a project where I need to interface two SPI peripherals with an ST microcontroller (STM32G070RBT6).
One peripheral (ADS124S06) operates in 
SPI Mode 1 (CPOL=0, CPHA=1), and the other (64128L FC BW-RGB Display) in SPI Mode 0 (CPOL=0, CPHA=0).
Both peripherals must operate concurrently to ensure real-time data visualization.

  1. Is it possible to use a single SPI interface for both peripherals, even though they require different modes?

  2. If yes, what is the best way to handle this?  ---Should I reconfigure the SPI mode dynamically before communicating with each device?
  3. Are there any potential timing or synchronization issues to consider?

Thank you in advance for your support!

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

1) Yes.

2) Yes. Depending on your comfort level, either reconfigure directly in registers or tear the whole thing down with HAL_SPI_DeInit and set back up in HAL_SPI_Init. Ensure CS pins remain high while other pins are reconfigured.

3) In general, no. If CS pins are handled appropriately, the device will ignore the other SPI line activity while CS pins are low. Double check datasheets to ensure this is the case. Ensure CLK line is activated prior to setting CS low. A logic analyzer will help out here.

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

View solution in original post

1 REPLY 1
TDK
Super User

1) Yes.

2) Yes. Depending on your comfort level, either reconfigure directly in registers or tear the whole thing down with HAL_SPI_DeInit and set back up in HAL_SPI_Init. Ensure CS pins remain high while other pins are reconfigured.

3) In general, no. If CS pins are handled appropriately, the device will ignore the other SPI line activity while CS pins are low. Double check datasheets to ensure this is the case. Ensure CLK line is activated prior to setting CS low. A logic analyzer will help out here.

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