Skip to main content
ihouses ihouses
Associate III
February 26, 2018
Question

Cube MX configures MISO and MOSI as outputs in SPI Full Duplex Master

  • February 26, 2018
  • 2 replies
  • 776 views
Posted on February 26, 2018 at 11:43

I am using an STM32L031K6 and I configure SP1 as Full Duplex Master, I expect that MOSI is an output and MISO an input but Cube MX configures SPI1_MISO as a Alternate Function Push Pull and can not be changed.

If I short MISO and MOSI of course doesn't work because both are outputs.

Why is it like that?

Thanks.

    This topic has been closed for replies.

    2 replies

    ihouses ihouses
    Associate III
    February 26, 2018
    Posted on February 26, 2018 at 13:26

    I noticed that SPI1_MISO is connected to PB6 throw one 0Ohm resistor. Removing the resistor now I see that SPI1_MISO is configured as an input since I can short MISO and MOSI and see the same in the scope.

    waclawek.jan
    Super User
    February 26, 2018
    Posted on February 26, 2018 at 23:42

    Cube MX configures SPI1_MISO as a Alternate Function Push Pull and can not be changed.

    If I short MISO and MOSI of course doesn't work because both are outputs.

    They are not -  in Alternate Mode, the 'direction' of pin is controlled by the associated peripheral.

    Read the GPIO chapter of RM.

    JW