Page 1 of 1

Using HSPICS on GPIO15

Posted: Thu Jun 30, 2022 5:09 am
by sleepycat
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

Re: Using HSPICS on GPIO15

Posted: Thu Jun 30, 2022 5:20 am
by jimmo
We talked about this a few days ago on https://github.com/micropython/micropyt ... 1161176125 although the pin toggle delay wasn't discussed there.

Re: Using HSPICS on GPIO15

Posted: Thu Jun 30, 2022 6:11 am
by sleepycat
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?

Re: Using HSPICS on GPIO15

Posted: Thu Jun 30, 2022 12:14 pm
by jimmo
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.