Skip to content

Hard fault with Feather RP2350 + ST7789 display after resizing terminal followed by running a REPL command #10084

Open
@samblenny

Description

@samblenny

CircuitPython version and board name

Adafruit CircuitPython 9.2.4 on 2025-01-28; Adafruit Feather RP2350 with rp2350a

Code/REPL

from board import SPI, D5, D6                                                   
import displayio                                                                
from fourwire import FourWire                                                   
import supervisor                                                               
                                                                                
from adafruit_st7789 import ST7789                                              
                                                                                
                                                                                
# Initialize 320x240 ST7789 IPS display with terminal at 2x scale.              
# The 2x zoom makes it easier to read the display.                              
displayio.release_displays()                                                    
bus = FourWire(SPI(), chip_select=D5, command=D6)                               
display = ST7789(bus, width=320, height=240, rotation=270)                      
supervisor.reset_terminal(160, 120)                                             
zoom_2x = displayio.Group(scale=2)                                              
display.root_group = None                                                       
zoom_2x.append(displayio.CIRCUITPYTHON_TERMINAL)                                
display.root_group = zoom_2x

# To trigger the hard fault, connect to serial REPL and run a command like `1+1` or `print()`

Behavior

  1. When the board boots from a hard reset, the boot messages look normal, and I can open the REPL and get a prompt
  2. Editing a line of text at the REPL prompt works fine. But, as soon as I press Enter to run a command like 1+1, print("hello world"), or import board, the board resets. The only exception I found is if I press Enter on a blank line. In that case, I get another >>> prompt. A single space, a #, or anything else I tried would trigger a reset.
  3. Upon reconnecting to the serial terminal, it shows a hard fault message:
Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

Description

Hardware setup:

Libraries:

Notes on Reproducer Code:

  • I tried reducing the reproducer to something smaller, but all of the included lines appear to be necessary to trigger the bug.
  • If I just do a supervisor.reset_terminal(160, 120) without changing anything about the root group, the display shows 4 tiled copies of the 160, 120 terminal. But, the characters look kinda glitched. It seems possible there might be some kind of buffer overflow thing going on.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions