Pull down on SPI MISO (STM32)

Over here I learned that I should put unused GPIO pins in analog input mode to reduce power consumption.

Next up in my project is some SPI communication with a SX1272 LoRaWAN transceiver

The SX1272 let it MISO float when in sleep mode. And apparently the MISO pin on my NUCLEO_L152RE is in digital input mode.

Result is 20-30uA wasted. (took me a while to hunt down)

Now, it’s easy to fix my simply adding an external pull-down on MISO. But can it be done with the MCU itself?

I had the same problem with our STM32L4 LoRa boards (www.radioshuttle.de). I have used an external 1M to GND pulldown for our Turtle board to get the noice with wakeups solved. Now I am at about 1µA.
I had as well the same problem with an extern SPI Flash chip, same solution.

It was as well very hard for me to find the source the the problem, fingering the pins was helpful to see deep sleep power changes.
Regards Helmut