forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-beta.3 on 2025-08-29; Adafruit-Qualia-S3-RGB666 with ESP32S3
Board ID:adafruit_qualia_s3_rgb666
Code/REPL
# Test Qualia ESP32-S3 with RGB-666 4" Square Display
# Combination of CircuitPython internet test and RGB-666 4" square display setup
import os
import ipaddress
import ssl
import wifi
import socketpool
import adafruit_requests
import time
import supervisor
import json
import microcontroller
# Display libraries
import displayio
import busio
import board
import dotclockframebuffer
from framebufferio import FramebufferDisplay
from adafruit_display_text.bitmap_label import Label
from adafruit_bitmap_font import bitmap_font
# URLs to fetch from
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_QUOTES_URL = "https://www.adafruit.com/api/quotes.php"
JSON_STARS_URL = "https://api.github.com/repos/adafruit/circuitpython"
# 4-inch square RGB-666 TFT with capacitive touch settings
displayio.release_displays()
tft_pins = dict(board.TFT_PINS)
tft_timings = {
"frequency": 16000000,
"width": 720,
"height": 720,
"hsync_pulse_width": 2,
"hsync_front_porch": 46,
"hsync_back_porch": 44,
"vsync_pulse_width": 2,
"vsync_front_porch": 16,
"vsync_back_porch": 18,
"hsync_idle_low": False,
"vsync_idle_low": False,
"de_idle_high": False,
"pclk_active_high": False,
"pclk_idle_high": False,
}
init_sequence_tl040hds20 = bytes()
board.I2C().deinit()
i2c = busio.I2C(board.SCL, board.SDA)
tft_io_expander = dict(board.TFT_IO_EXPANDER)
#tft_io_expander['i2c_address'] = 0x38 # uncomment for rev B
dotclockframebuffer.ioexpander_send_init_sequence(i2c, init_sequence_tl040hds20, **tft_io_expander)
i2c.deinit()
bitmap = displayio.OnDiskBitmap("/display-ruler-720p.bmp")
# NOTE: The following lines causes JSON requests (and sometimes ping tests) to fail...
# ===> Comment-out from here...
'''
fb = dotclockframebuffer.DotClockFramebuffer(**tft_pins, **tft_timings)
display = FramebufferDisplay(fb, auto_refresh=False)
# Create a TileGrid to hold the bitmap
tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
# Create a Group to hold the TileGrid
group = displayio.Group()
# Add the TileGrid to the Group
#group.append(tile_grid)
# Add the Group to the Display
display.root_group = group
label_font = bitmap_font.load_font("/fonts/helvB18.bdf")
anchored_position = (display.width//2, display.height//2)
display.auto_refresh = True
'''
# ===> ...to here to test wifi functionality...
print("ESP32-S2 WebClient Test")
print(f"My MAC address: {[hex(i) for i in wifi.radio.mac_address]}")
print("Available WiFi networks:")
for network in wifi.radio.start_scanning_networks():
print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
network.rssi, network.channel))
wifi.radio.stop_scanning_networks()
print(f"Connecting to {os.getenv('CIRCUITPY_WIFI_SSID')}")
wifi.radio.connect(os.getenv("CIRCUITPY_WIFI_SSID"), os.getenv("CIRCUITPY_WIFI_PASSWORD"))
print(f"Connected to {os.getenv('CIRCUITPY_WIFI_SSID')}")
print(f"My IP address: {wifi.radio.ipv4_address}")
ping_ip = ipaddress.IPv4Address("8.8.8.8")
ping = wifi.radio.ping(ip=ping_ip)
# retry once if timed out
if ping is None:
ping = wifi.radio.ping(ip=ping_ip)
if ping is None:
print("Couldn't ping 'google.com' successfully")
else:
# convert s to ms
print(f"Pinging 'google.com' took: {ping * 1000} ms")
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
print(f"Fetching text from {TEXT_URL}")
response = requests.get(TEXT_URL)
print("-" * 40)
print(response.text)
print("-" * 40)
print(f"Fetching json from {JSON_QUOTES_URL}")
response = requests.get(JSON_QUOTES_URL)
print("-" * 40)
print(response.json())
print("-" * 40)
print()
print(f"Fetching and parsing json from {JSON_STARS_URL}")
response = requests.get(JSON_STARS_URL)
print("-" * 40)
print(f"CircuitPython GitHub Stars: {response.json()['stargazers_count']}")
print("-" * 40)
print("Done with internet test")
'''
# 4-inch square RGB-666 TFT with capacitive touch test
print("Begin display test...")
print("len(group): ",len(group))
[group.pop() for _ in range(len(group))]
top_left = Label(
font=label_font, #terminalio.FONT,
text="Top Left",
background_tight=True,
anchor_point=(0,0),
anchored_position=(0,0),
color=(0,0,255),
)
group.append(top_left)
top_right = Label(
font=label_font, #terminalio.FONT,
text="Top Right",
background_tight=True,
anchor_point=(1,0),
anchored_position=(display.width,0),
color=(255,0,0),
)
group.append(top_right)
middle = Label(
font=label_font, #terminalio.FONT,
text="Middle",
background_tight=True,
anchor_point=(0.5,0.5),
anchored_position=(display.width//2, display.height//2),
color=(255,255,255),
)
group.append(middle)
bottom_left = Label(
font=label_font, #terminalio.FONT,
text="Bottom Left",
background_tight=True,
anchor_point=(0,1),
anchored_position=(0, display.height),
color=(255,155,0),
)
group.append(bottom_left)
bottom_right = Label(
font=label_font, #terminalio.FONT,
text="Bottom Right",
background_tight=True,
anchor_point=(1,1),
anchored_position=(display.width,display.height),
color=(0,255,0),
)
group.append(bottom_right)
# Loop forever so you can enjoy your image
#while True:
#pass
time.sleep(30) # Sleep for 30 seconds to hold display
'''
Behavior
ESP32-S2 WebClient Test
My MAC address: ['0x94', '0xa9', '0x90', '0x1b', '0x11', '0xc0']
Available WiFi networks:
ngc253 RSSI: -40 Channel: 3
Connecting to ngc253
Connected to ngc253
My IP address: 192.168.0.201
Pinging 'google.com' took: 192.0 ms
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)
----------------------------------------
Fetching json from https://www.adafruit.com/api/quotes.php
Traceback (most recent call last):
File "code.py", line 120, in <module>
File "adafruit_requests.py", line 721, in get
File "adafruit_requests.py", line 649, in request
File "adafruit_connection_manager.py", line 339, in get_socket
File "adafruit_connection_manager.py", line 248, in _get_connected_socket
OSError: [Errno 116] ETIMEDOUT
Code done running.
Adafruit CircuitPython 10.0.0-beta.3 on 2025-08-29; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>>
Program hangs for 30+ seconds at the "Fetching json from https://www.adafruit.com/api/quotes.php" step before crashing.
Ping test will sometimes also fail.
Description
- When I try to setup the RGB-666 display with wifi tests (notably, JSON), the wifi tests (again, mainly JSON) fail.
- The offending display setup line appears to be:
fb = dotclockframebuffer.DotClockFramebuffer(**tft_pins, **tft_timings)
- If I comment-out the display setup from
fb...
todisplay.auto_refresh = True
, all wifi tests succeed. - Tested with two most-recent betas of CircuitPython 10.0.0 (beta.2 and beta.3)
Additional information
Additional files attached to run test script above. Had to change extension to .bdf file to allow posting.