Using HSPICS on GPIO15

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
sleepycat
Posts: 2
Joined: Thu Jun 30, 2022 4:35 am

Using HSPICS on GPIO15

Post by sleepycat » Thu Jun 30, 2022 5:09 am

Is there any way to get around the ~125 microsecond delay when doing Pin toggle for CS before and after an SPI transaction?

For use cases with a single SPI device and one master, it seems advantageous to access the hardware CS.

https://github.com/micropython/micropyt ... spi.c#L102 seems to indicate there was some thought at one time to set up the ESP GPIO from HSPICS at the hardware level. Is there any way to call PIN_FUNC_SELECT() from Python?

There is also an open issue for this on Github: https://github.com/micropython/micropython/issues/2509

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

Re: Using HSPICS on GPIO15

Post by jimmo » Thu Jun 30, 2022 5:20 am

We talked about this a few days ago on https://github.com/micropython/micropyt ... 1161176125 although the pin toggle delay wasn't discussed there.

sleepycat
Posts: 2
Joined: Thu Jun 30, 2022 4:35 am

Re: Using HSPICS on GPIO15

Post by sleepycat » Thu Jun 30, 2022 6:11 am

Interesting approach taken by Owen.

The decision makes sense, and I understand the reasoning behind it.

That said, hiding a hardware feature of the ESP device seems like a disadvantage.

Here is an example of the delay:


Image

Code: Select all

cs.value(0)
spi.write(b'\xac')
cs.value(1)
Is there anything to be done to tighten up the CS toggle around the SPI transaction, or is this simply a limitation of the Python abstraction?

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

Re: Using HSPICS on GPIO15

Post by jimmo » Thu Jun 30, 2022 12:14 pm

sleepycat wrote:
Thu Jun 30, 2022 6:11 am
Is there anything to be done to tighten up the CS toggle around the SPI transaction, or is this simply a limitation of the Python abstraction?
It is marginally faster to write

cs(0)

rather than

cs.value(0)

as it avoids the lookup of the value function but yeah right now this is a limitation.

Post Reply