ESP32-S2 "Timed out waiting for SPI char" error

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
HowdyMoto
 
Posts: 23
Joined: Sat Jun 05, 2021 11:41 pm

ESP32-S2 "Timed out waiting for SPI char" error

Post by HowdyMoto »

Hi All,

I see there have been plenty of other threads about this problem, but none of them offer solutions. My PyPortal Titano intermittently crashes with the error: "Timed out waiting for SPI char". I am running the very latest CircuitPython UF2 (tried 6.x a while back, 7.0, and now using 7.1 beta) along with the latest libraries. And I've updated the firmware to nina 1.7.4 from here: https://github.com/adafruit/nina-fw/releases/tag/1.7.4

The code I'm running just checks stock prices, and the source can be seen here:
https://github.com/HowdyMoto/StockTrack ... tal_Titano

When the issue happens, it's when it tries to request data from the server:

Code: Select all

def getprice(asset, pricelabel, changelabel):
    try:
        response = requests.get(URL_BASE + asset + URL_APIKEY + api_key + URL_FORMAT)
        response_json = response.json()

        price_unformatted = float(response_json["close"])
        price_delta_unformatted = float(response_json["change_p"])    # get the percentage change, which can be many decimal places

        price = "%.2f" % price_unformatted                            # Create a string from a float and round the price to 2 decimal places
        price_delta = "%.1f" % price_delta_unformatted                # Create a string from a float and round the price to 2 decimal places 

        if price_delta_unformatted >= 0:
            pricelabel.color = GREEN
            changelabel.color = GREEN
        else:
            pricelabel.color = RED
            changelabel.color = RED
        pricelabel.text = price
        changelabel.text = price_delta + "%"

    except (ValueError, RuntimeError) as e:
        print("Error: ", e)
        background_rect.fill = DARKRED
        microcontroller.reset()
The program never recovers from the error. So, I ended up just forcing the device to reboot when this happens with the last line. It's workable, but I really want to know a better way to handle this error, since I'm hoping to give some of these as holiday gifts to friends.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”