Skip to main content
Graduate
July 25, 2024
Solved

Connections for STM32L4 SPI slave

  • July 25, 2024
  • 2 replies
  • 1385 views

I have an STM32L433 that implements a SPI slave, it is connected to another MCU master. It is unclear from the datasheet and searches for answers whether MISO and MOSI on the slave should connect directly to MISO and MOSI on the master, or, if they should be crossed.

 

Is master MOSI -> slave MOSI and master MISO to slave MISO correct?

Sid

    This topic has been closed for replies.
    Best answer by Andrew Neil

    Ah, right - I see what you mean!

    The RM suggests that the direction of the pin does depend on whether the peripheral is in Master or Slave mode:

    AndrewNeil_1-1721920861661.png

     

    A fine example of data that would have been much clearer if presented as a table 

     

    2 replies

    Super User
    July 25, 2024

    The names say it all:

    MOSI = Master Out, Slave In;

    MISO = Master In, Slave Out.

     


    @SidPrice wrote:

    Is master MOSI -> slave MOSI and master MISO to slave MISO correct?


    Yes. This is standard SPI - nothing specific to STM32

    AndrewNeil_0-1721919866780.png

    https://en.wikipedia.org/wiki/Serial_Peripheral_Interface 

    SidPriceAuthor
    Graduate
    July 25, 2024

    Thank you, yes, I fully understand that. Perhaps I should have been more specific.

    I am concerned about the connections on the STM32L4. PA6 is SPI1 MISO, PA7 is SPI1 MOSI. So, when the L4 is a slave, the master MOSI is connected to PA6 or PA7.

     

    Super User
    July 25, 2024

    Ah, right - I see what you mean!

    The RM suggests that the direction of the pin does depend on whether the peripheral is in Master or Slave mode:

    AndrewNeil_1-1721920861661.png

     

    A fine example of data that would have been much clearer if presented as a table 

     

    SidPriceAuthor
    Graduate
    July 25, 2024

    @Andrew Neil Thank you, I missed that in the TRM.

    I think I should be able to put Master MISO on PA6 of the slave and master MOSI on PA7.

    Again, thanks for the prompt input :beaming_face_with_smiling_eyes: