adafruit / adafruit/Adafruit_CircuitPython_ESP32SPI

ESP_SPIcontrol._wait_for_ready is eating lots of time polling the READY/BUSY pin

Open
#108 12 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
102
Forks
71
Avg merge
2d 1h
Merged PRs (30d)
1

Description

Context:
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/106
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/master/adafruit_esp32spi/adafruit_esp32spi.py#L176

I haven't verified this exhaustively, but as far as I can tell, practically every method in ESP_SPIcontrol will at some point call _wait_for_ready somewhere in it's call stack.

I've got a simple sensor logger that's calling IO using an airlift, and round trip for a **successful** post is on average about 8 seconds. Only about 2-3 seconds of that is actually opening sockets, sending, receiving, parsing, etc, the rest of the time we're waiting for the ESP32.

This means that until I added the hack in the PR above, I couldn't have a UI. The hack was admittedly a hack so I closed it, but this is a problem that should be solved one way or another

@tannewt suggested starting on the async/concurrency project which would be nice, but I don't see that being done any time soon and it would be nice to have this addressed in some capacity before then

Contributor guide

No contributing guide indexed for this repository

Research direction

Read adafruit_esp32spi/adafruit_esp32spi.py around line 176 and review pull request 106 for the earlier polling hack. Reproduce the sensor logger's successful POST and measure time spent waiting for the ESP32 versus network operations. Done means the READY/BUSY wait no longer consumes excessive time while successful ESP32SPI requests remain reliable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.