2025-04-25 8:06 AM
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?
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.
2025-04-25 8:08 AM - edited 2025-04-25 8:10 AM
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.
2025-04-25 8:13 AM
Wow, speak about quick responds.
Great I will power-up the board and report back later,
Thanks,
Hans.