cancel
Showing results for 
Search instead for 
Did you mean: 

Temporarily Isolate SPI Master

hans86
Associate III

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.

2 REPLIES 2
TDK
Guru

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".
hans86
Associate III

Wow, speak about quick responds.

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

Thanks,
Hans.