Skip to main content
Associate III
April 25, 2025
Solved

Temporarily Isolate SPI Master

  • April 25, 2025
  • 1 reply
  • 2749 views

Hi All,

I have a system with 2 SPI masters and a single slave very similar to this post from 2014:

https://community.st.com/t5/stm32-mcus-products/spi-multi-master-mode-with-stm32f050/td-p/502107

What I would like to do is to temporarily isolate the STM32 SPI master from the bus when the second SPI master is in control.  I don't want to re-init the STM32 SPI between Master and Slave as it might affect the DMA setup so I was thinking of simply changing the CLK and MOSI lines temporarily to input, will this work?

hans86_0-1745593343392.png

Something like this:

Enable Master:

LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_5, LL_GPIO_MODE_ALTERNATE); 
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_7, LL_GPIO_MODE_ALTERNATE); 

 Isolate Master:

LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_5, LL_GPIO_MODE_INPUT); 
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_7, LL_GPIO_MODE_INPUT); 

Thanks,
Hans.

Best answer by TDK

Yep, that should do it.

Will also need to do that for NSS if it's an output, and have a method for determining when the other SPI master is there.

1 reply

TDK
TDKAnswer
Super User
April 25, 2025

Yep, that should do it.

Will also need to do that for NSS if it's an output, and have a method for determining when the other SPI master is there.

"If you feel a post has answered your question, please click ""Accept as Solution""."
hans86Author
Associate III
April 25, 2025

Wow, speak about quick responds.

Great I will power-up the board and report back later,

Thanks,
Hans.

hans86Author
Associate III
April 28, 2025

Worked like a charm,

Thanks,
Hans.