Skip to content

OnDiskBitmap appears to be corrupting memory #5008

@dhalbert

Description

@dhalbert

[simplified a bit from original issue]

CircuitPython version

7.0.0-alpha.4 on Tiny2040

Code/REPL

import board
import busio
import displayio
import digitalio
from adafruit_st7789 import ST7789
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
import usb_midi
from adafruit_midi.note_on          import NoteOn
from adafruit_midi.note_off         import NoteOff

keyboard = Keyboard(usb_hid.devices)
ctrl = Keycode.CONTROL
key0 = Keycode.S
key1 = Keycode.X
key2 = Keycode.C
key3 = Keycode.V
shortcuts = [key0, key1, key2, key3]

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

#  spi display setup
spi = board.SPI()
tft_cs = board.D7
tft_dc = board.D5

display_bus = displayio.FourWire(
    spi, command=tft_dc, chip_select=tft_cs, reset=board.D6
)

#  display setup
display = ST7789(display_bus, width=240, height=240, rowstart=80)

#  bitmap setup
print(1, displayio)
bitmap = displayio.OnDiskBitmap(open("/parrot-240-sheet.bmp", "rb"))
print(2, displayio)

Behavior

Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Adafruit QT Py RP2040 with rp2040
>>> import code1
1 <module 'displayio'>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "code1.py", line 39, in <module>
NameError: name 'displayio' is not defined
>>> 

Description

code is adapted from https://learn.adafruit.com/kitty-toe-bean-paw-keypad-color-tct/overview, adapted for TinyRP2040 pinout.

@cmora111 was trying the original Learn Guide program, and saw incorrect usb_hid errors. I tried the original program on a QT Py RP2040, and saw something like the above. I trimmed the program to what is above. Trimming it further (even removing comments!) causes the breakage above not to happen, so it appears to be some kind of memory corruption.

Additional information

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions