MatrixPortal crashes after continuous activity

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
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

MatrixPortal crashes after continuous activity

Post by fishycircuits »

Hi there,

My MatrixPortal is crashing with “timed out waiting for SPI char” and occasionally “ESP32 not responding” errors after running continuously for hours.

From the below tracebacks, it looks like a communication error between the main processor and the ESP32, and therefore not something I can fix in my code. Or is there something I’m missing?


Here is my code: https://github.com/ajs256/matrixportal- ... in/code.py

Here is a sample “timed out” traceback:

Code: Select all

'Traceback (most recent call last):', 
'  File "code.py", line 361, in <module>', 
'  File "code.py", line 361, in <module>', 
'  File "code.py", line 356, in <module>', 
'  File "adafruit_requests.py", line 684, in get', 
'  File "adafruit_requests.py", line 562, in request', '  File "adafruit_requests.py", line 420, in _get_socket', 
'  File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 43, in getaddrinfo', '  File "adafruit_esp32spi/adafruit_esp32spi.py", line 608, in get_host_by_name', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 325, in _send_command_get_response', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 308, in _wait_response_cmd', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 292, in _wait_response_cmd', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 271, in _wait_spi_char',
'RuntimeError: Timed out waiting for SPI char'
And here is a “ESP32 not responding” traceback:

Code: Select all

'Traceback (most recent call last):', 
'  File "code.py", line 361, in <module>', 
'  File "code.py", line 361, in <module>', 
'  File "code.py", line 356, in <module>', 
'  File "adafruit_requests.py", line 684, in get', 
'  File "adafruit_requests.py", line 562, in request', 
'  File "adafruit_requests.py", line 420, in _get_socket', 
'  File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 43, in getaddrinfo', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 608, in get_host_by_name', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 324, in _send_command_get_response', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 231, in _send_command', 
'  File "adafruit_esp32spi/adafruit_esp32spi.py", line 190, in _wait_for_ready', 'RuntimeError: ESP32 not responding',
Sorry for the weird formatting, my hacked-together serial logger code doesn’t format it nicely.

Here’s my boot_out.txt:

Code: Select all

Adafruit CircuitPython 6.3.0 on 2021-06-01; Adafruit Matrix Portal M4 with samd51j19
and the output of “circup freeze”:

Code: Select all

adafruit_requests==1.9.9
neopixel==6.1.3
adafruit_display_text==2.18.6
adafruit_bus_device==5.0.6
adafruit_io==5.4.0
adafruit_esp32spi==3.5.11
(all latest versions as of 7/12/21)

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

What RGB matrix are you using?

How are you powering the setup?

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

1. A 64x32 matrix, the same one that was in AdaBox018.
2. A microUSB wall wart - https://www.adafruit.com/product/1995

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

That all seems OK. You have some kind of adapter to go from the power supply to the MatrixPortal's USB-C?

Does it seem to recover OK if you restart or reset the program right after hitting that issue?

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

Yes, I have an adapter.

It recovers after pressing the reset button, but crashes again some time later.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

Sorry for the weird formatting, my hacked-together serial logger code doesn’t format it nicely.
Could this be affecting the traceback text also? The initial lines in code.py don't seem to correlate to anything using the ESP32:
'Traceback (most recent call last):',
' File "code.py", line 361, in <module>',
' File "code.py", line 361, in <module>',
' File "code.py", line 356, in <module>',
Both of those lines call some simple helper functions that don't access or use the ESP32.

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

Oh, sorry about that. I've probably revised the code since that was logged. It was probably actually on line 336: https://github.com/ajs256/matrixportal- ... de.py#L336

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

So you actually see that print:
Failed to get weather: {exception text here}
and then get the traceback?

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

Yes.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

Try adding a delay in that retry loop.

Code: Select all

        for i in range(1, 4):  # inclusive, exclusive
            print("Try " + i + " of 3")
            try:
                weather_response = requests.get(OPENWEATHER_ENDPOINT)  # Grab data from OpenWeather.
                weather_json = weather_response.json() # Parse the JSON.
            except RuntimeError as ex:
                print("Failed to get weather: " + str(ex))
                if i == 3:
                    raise  # We're done here, let's give up.
                time.sleep(30) # or more?
            else: # If it is successful:
                break
Looks like you are only trying to update once every 10 minutes. So should be OK to make that retry delay something that is several 10s of seconds, or even more.

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

I'll try that, but one issue with that is that it would block, delaying the update of the time. It's ok though, it's not like I'm using this to time a rocket launch :)

User avatar
fishycircuits
 
Posts: 46
Joined: Wed Oct 28, 2020 5:04 pm

Re: MatrixPortal crashes after continuous activity

Post by fishycircuits »

Nope! It's still crashing with presumably the same error (I removed the logger, so I'm not sure)

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: MatrixPortal crashes after continuous activity

Post by adafruit_support_carter »

Can you try capturing the exception again and posting the actual text.
Failed to get weather: {exception text here}
What is the actual exception text?

And if code has changed, link again to actual code being run.

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

Return to “Adafruit CircuitPython”