Skip to content

SPI: wrong mosi pull-up / pull-down state / can't change settings #10998

@sebert007

Description

@sebert007

It seems that an SPI instance (SPI, not SoftSPI) switches the pull-up resistor on for MOSI by default.

I am using the following code:


miso_pin = Pin(SPI_STD_MISO_PIN, Pin.IN, Pin.PULL_DOWN)

spi_std = SPI(SPI_STD_DEVICE,
              sck=Pin(SPI_STD_SCK_PIN),
              mosi=Pin(SPI_STD_MOSI_PIN),
              miso=miso_pin
              baudrate=SPI_STD_BAUD_RATE,
              polarity=SPI_STD_POL,
              phase=SPI_STD_PH,
              bits=SPI_STD_BITS,
              firstbit=SPI_STD_FIRSTBIT)

Just for information the variables:

SPI_STD_DEVICE = 1
SPI_STD_SCK_PIN = 8
SPI_STD_MOSI_PIN = 6
SPI_STD_MISO_PIN = 7
SPI_STD_BAUD_RATE = 1_000_000
SPI_STD_POL = 0
SPI_STD_PH = 0
SPI_STD_BITS = 8
SPI_STD_FIRSTBIT = SPI.MSB

The MOSI pin pulls high on my oscilloscope after the SPI instantiation. This is really bad, since SPI devices normally are not able to sink current. This means, that MOSI will remain pulled up and data transmission to the master does not work.

It seems that the Pin.PULL_DOWN parameter is overwritten or not taken into account.

As a result it is not possible to use SPI without the pull-up resistor switched on.

SoftSPI doesn't seem to show this behavior but is not an alternative to the hardware SPI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions