Page 1 of 1

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

Posted: Sun Jan 10, 2021 10:32 pm
by maxe
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

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

Posted: Sun Jan 10, 2021 11:49 pm
by davef
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?

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

Posted: Mon Jan 11, 2021 12:16 am
by maxe
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.

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

Posted: Mon Jan 11, 2021 1:08 am
by jimmo
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).

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

Posted: Mon Jan 11, 2021 2:10 am
by maxe
Thanks I will give it a try right away. Shift register here I come :)