Skip to content

esp8266: nativeio.SPI doesn't seem to drive MOSI and SCK #60

@tdicola

Description

@tdicola

Trying out hardware SPI on the ESP8266 and unfortunately it looks like the clock and MOSI aren't working (perhaps MISO too, haven't tried). Here's a repro:

import board
import nativeio
spi = nativeio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO, baudrate=1000000)
cs = nativeio.DigitalInOut(board.GPIO0)
cs.switch_to_output()
cs.value = 1
def test():
    cs.value = 0
    spi.write(bytearray([255, 128, 64, 32, 16, 0]))
    cs.value = 1

I hooked up SCK, MOSI, and GPIO0 (the cs pin in this test) to a Saleae and had it trigger on cs falling from high to low (right before the SPI write). Started the capture (at 100mhz, well above the 1mhz baudrate) and ran the test function:

test()

With the Saleae I can see it triggers on the cs pin change and captures data, but I only see the cs pin toggle low to high and not anything written on clock or MOSI lines:
screen shot 2016-12-01 at 7 37 55 pm
Notice the dip in the channel 2 (cs / enable) but nothing on channel 0 (clock) and channel 1 (MOSI).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions