machine.SoftSPI not available for ESP-01 (esp8266)

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
maxe
Posts: 8
Joined: Sun Jan 10, 2021 10:30 pm

machine.SoftSPI not available for ESP-01 (esp8266)

Post by maxe » Sun Jan 10, 2021 10:32 pm

Hi there,

I am new to micropython so maybe my question is super obvious. I try to use a shift register with the ESP01 module. For that I would need the SPI but machine.SoftSPI isn't available. Did I flash the wrong firmware or does it simply not exist?

Thanks,
Max

davef
Posts: 134
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: machine.SoftSPI not available for ESP-01 (esp8266)

Post by davef » Sun Jan 10, 2021 11:49 pm

Which ESP-01 variant do you have? I use some ESP-01S units and looking at the soft.SPI doc it looks like you need GPIO0, GPIO2 and GPIO4. Maybe GPIO4 could be re-named to the TX or RX pin, which means you would not be able to use the UART.

I have moved up a notch and getting some ESP-07S which have many more pins available.

Which firmware version are you trying to use?

maxe
Posts: 8
Joined: Sun Jan 10, 2021 10:30 pm

Re: machine.SoftSPI not available for ESP-01 (esp8266)

Post by maxe » Mon Jan 11, 2021 12:16 am

I use esp8266-1m-20200902-v1.13 and I have the really basic ESP-01 non S chip. There are GPIO0 and GPI2 while 1 and 4 are TX/RX but they could be used for software SPI. The problem is that the class isn't available. I am using the WebREPL anyway so I don't need the serial connection.

User avatar
jimmo
Posts: 2059
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: machine.SoftSPI not available for ESP-01 (esp8266)

Post by jimmo » Mon Jan 11, 2021 1:08 am

maxe wrote:
Mon Jan 11, 2021 12:16 am
I use esp8266-1m-20200902-v1.13
machine.SoftSPI was added since v1.13 was released (i.e. it will be in the upcoming v1.14 release).

In 1.13 and earlier, you can use machine.SPI() and depending on whether you specify the "id" argument, you get the hardware or soft implementation.

Please see the v1.13 documentation here -- http://docs.micropython.org/en/v1.13/

(I know it's confusing... when you got to the "latest" documentation at http://docs.micropython.org/en/latest/ it says "This is the documentation for MicroPython v1.13, last updated 11 Jan 2021." which needs to be fixed).

maxe
Posts: 8
Joined: Sun Jan 10, 2021 10:30 pm

Re: machine.SoftSPI not available for ESP-01 (esp8266)

Post by maxe » Mon Jan 11, 2021 2:10 am

Thanks I will give it a try right away. Shift register here I come :)

Post Reply