Skip to content

Hard crash on ESP32S2 using 2 displays #7472

Open
@darianbjohnson

Description

@darianbjohnson

CircuitPython 8.0.0-beta.6
Board - Adafruit Feather ESP32s2

Error message:

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
NLR jump failed. Likely memory corruption.
Please file an issue with the contents of your CIRCUITPY drive at 
https://github.com/adafruit/circuitpython/issues

Code:

import board
import displayio
import vectorio
import terminalio
from adafruit_simplemath import map_range
from adafruit_display_text import bitmap_label, wrap_text_to_lines, label #remove label later
from adafruit_st7789 import ST7789
import adafruit_imageload
from adafruit_bitmap_font import bitmap_font
import time
import gc
import math
import random
import rtc

import hexTileFunctions as hexFuncs


PANTHER_FONT_16 = bitmap_font.load_font("/fonts/Panther-16.bdf")
PANTHER_FONT_25 = bitmap_font.load_font("/fonts/Panther-25.bdf")
PANTHER_FONT_20 = bitmap_font.load_font("/fonts/Panther-20.bdf")
PANTHER_FONT_33 = bitmap_font.load_font("/fonts/Panther-33.bdf")
WEATHER_FONT = bitmap_font.load_font("/fonts/weather-31.bdf")


# Release any resources currently in use for the displays
displayio.release_displays()

# define main display
spi = board.SPI()
tft_cs = board.D9
tft_dc = board.D10

# define menu display
menu_tft_cs = board.D12
menu_tft_dc = board.D11

# set up menu display
menu_display_bus = displayio.FourWire(spi, command=menu_tft_dc, chip_select=menu_tft_cs)
menu_display = ST7789(
    menu_display_bus, rotation=0, width=135, height=240, rowstart=40, colstart=53
)

print(" menu bus", gc.mem_free())

# Make the display context
splash = displayio.Group()
menu_display.show(splash)

menuLabel = bitmap_label.Label(PANTHER_FONT_25, text="1abc\n2def\n3abc\n4def\n5abc\n6def\n7abc\n8def", color=0xFFFFFF, scale = 1,anchor_point = (0.0, 0.0), anchored_position= (0, 0))

splash.append(menuLabel)

# set up maindisplay
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(display_bus, width=240, height=320, rotation=0)

print(" display bus 2", gc.mem_free())

while True:
    pass

Background
I compiled a new version of CPy for the ESP32s2 Feather, and I added a line to the mpconfig.h file to use two displays [#define CIRCUITPY_DISPLAY_LIMIT (2)]

The code compiles; and I am able to get the code to run on a first attempt. However, when I make a code change and save the file, I get the error listed above. The Mu editor looses the ability to write to the file and the board starts to run in safe mode.

I'm not exactly sure what I am doing wrong. Any thoughts?

Note - I am attempting to make a DEBUG version of the code for testing, but I'm running out of room on the board. Any ideas on what files to move so that I can create a DEBUG version?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions