cancel
Showing results for 
Search instead for 
Did you mean: 

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

ihouses ihouses
Associate III
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.

2 REPLIES 2
ihouses ihouses
Associate III
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.

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