cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Multi-Master mode with STM32F050

dirk
Associate
Posted on January 14, 2014 at 15:35

Hey Guys,

I have some question about the SPI Multi-Master mode with the STM32F050.

What I want to do is shown in the Picture. I have two Boards connected over a plug.

When they are pluged together, the MCU is the SPI Master. So the STM32 is in Slave mode.

When the Master MCU isn't connected, the STM32 should be the SPI Master.

Is it possible to do something like that with the STM32? In the Reference Manuel at page 645 is written

that the STM32 goes into Slave mode when the NSS pin is pulled low and then the NSS pin works as an standard chip select.

But how can I change from Slave to Master mode when the MCU Master is separated?

Maybe somebody has some experience with SPI Mulit-Master.

Thanks a lot.

Dirk

0690X000006051EQAQ.png
3 REPLIES 3
chen
Associate II
Posted on January 14, 2014 at 16:27

Hi

No it is not possible :

http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

There is no such thing as SPI Multi Master.

''that the STM32 goes into Slave mode when the NSS pin is pulled low and then the NSS pin works as an standard chip select.''

The clue is in the words ''Slave mode'' - this is used to operate the SPI peripheral in Slave mode. It would end up clocking the data in as well as the other device, if it works at all since it is set up as a master.

What you can do is have the STM32 detect the other board/processor (use an IO pin) and disable the SPI when the other board is attached.

dirk
Associate
Posted on January 23, 2014 at 11:50

Hi sung.chen-chung,

thanks for response. I know that SPI isn't a Multi Master bus, but I hope that the functionality of the STM32 can manage over the NSS pin that there is only one Master simultaneously.

Below the extract of the Reference Manuel which describes this mode.

0690X000006055eQAA.png

0690X000006053aQAA.png

Has someone used this mode from the STM32?

Dirk

chen
Associate II
Posted on January 23, 2014 at 12:02

Hi

What you have highlighted in yellow means that the STM32 SPI peripheral can switch between being a SPI master to a SPI device.

NOT what you want!

You want to switch between 2 SPI masters.

As I said before, it is up to one of the SPI masters to detect the other and then disable itself.

It will be easier to do it this way than to try and get the SPI peripheral to do something it is not designed to do. It may be possible (I do not know - I actually have not tried the STM32 SPI peripheral). My bet is ST will but endorse or guarantee it.

''Has someone used this mode from the STM32?''

Yes, I am sure there are users of the STM32 SPI peripheral that configure it to be a SPI slave/device.