cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F031C4 SPI with multiple slaves

shivkiyer
Associate
Posted on May 19, 2016 at 00:21

Hello all,

I am trying to use the STM32F031C4 for a power converter application. The microcontroller has inbuilt ADCs, but due to grounding issues, we need to use external ADCs to convert some of the analog signals and feed the digital values to the microcontroller. We intend to use SPI for the interface. However, the microcontroller has only one SPI.

So my question is has anyone used multiple peripherals with a single SPI? Is it possible to generate a multiplexed chip select signal to choose different devices? Also, when a device is not selected, will its data lines be tristated? Because if the data lines are shared between different peripherals, if the lines are always active even if the chip is not selected, it would be necessary to multiplex to the data lines along with the chip select.

Has anyone done this and could offer any suggestions. It is only 4 analog inputs that we need to interface through external ADCs. 5 analog signals will use the inbuilt ADC with the microcontroller.

Thank you in advance.

1 REPLY 1
Posted on May 19, 2016 at 00:46

You can use multiple GPIO lines to perform as Chip Selects for the external devices. The way the SPI implementation works it is probably best done that way in any case.

Also, when a device is not selected, will its data lines be tristated?

I guess you'll need to review the documentation for your chosen ADCs, it's not the STM32 that is responsible for this.

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