Skip to content

stm32: Add Arduino UNO Q (STM32U585) board with LED matrix driver#19311

Open
EmbeddedAndroid wants to merge 2 commits into
micropython:masterfrom
EmbeddedAndroid:stm32-arduino-uno-q
Open

stm32: Add Arduino UNO Q (STM32U585) board with LED matrix driver#19311
EmbeddedAndroid wants to merge 2 commits into
micropython:masterfrom
EmbeddedAndroid:stm32-arduino-uno-q

Conversation

@EmbeddedAndroid
Copy link
Copy Markdown

Summary

The Arduino UNO Q is an STM32U585 paired with a Qualcomm application processor
running Linux. This adds a ports/stm32 board for the STM32U585 so MicroPython
runs natively on the MCU (there's already a ports/zephyr board for it in
#18940).

The board runs at 160MHz off the 16MHz HSE, boots straight from internal flash
with no bootloader, and is flashed over SWD. The REPL is on LPUART1, which is
the UART wired to the application processor. USB is off since the USB-C port
belongs to the AP. The Arduino header pins, USART1, I2C2 and SPI2 are exposed,
plus SPI3 to the AP.

The second commit adds a driver for the on-board 13x8 LED matrix. It's
charlieplexed across PF0..PF10, so a small C module scans it with TIM17 (one
pixel per interrupt) and exposes the frame buffer, and a frozen Python module
wraps that in a framebuf.FrameBuffer.

Testing

Built with gcc 13.2 and flashed on a UNO Q over SWD. Checked the REPL on
LPUART1, the internal filesystem, machine.freq() at 160MHz, and Pin/SPI/I2C
from the REPL. For the matrix I imported it and drew with fill/pixel/text, and
the panel lit correctly.

upy

I also ran the repo's CI checks locally (codeformat, ruff, codespell,
verifygitlog, and the stm32 build that now includes this board) and they pass locally.

Trade-offs and Alternatives

The matrix driver is board specific rather than a generic display driver because
the panel is charlieplexed straight onto fixed GPIOs. It takes over TIM17 for
the scan, so TIM17 isn't available via pyb.Timer on this board. It's mono and
full brightness for now; grayscale could come later.

I tried doing the scan in Python with machine.Timer first, but the refresh rate
it needs is too high for Python-level callbacks, so it has to run in a C
interrupt handler.

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

The Arduino UNO Q combines an application processor running Linux with an
STM32U585.  Add a board definition for the STM32U585: it runs at 160MHz
from the 16MHz HSE, executes from the start of internal flash (no
bootloader) and is programmed over SWD.

The REPL is on LPUART1, the UART that connects to the application
processor; USB is disabled because the USB-C port belongs to the
application processor.  The Arduino R3 header pins, USART1, I2C2 and SPI2
are exposed, along with SPI3 to the application processor.

Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
The UNO Q carries a 13x8 charlieplexed LED matrix (104 LEDs) on the
STM32U585 port F lines PF0..PF10.  Add a driver for it in two parts.

_ledmatrix is a C module that owns the lines and TIM17.  It scans one
pixel per timer interrupt, lighting it by driving its high line high and
its low line low while the other nine float, so persistence of vision
shows the whole frame.  The frame is a MONO_VLSB buffer exposed to Python
as a writable memoryview.

ledmatrix is a frozen module whose LedMatrix class wraps that buffer in a
framebuf.FrameBuffer, so the usual drawing methods are available and
edits appear on the panel without an explicit flush.

Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.47%. Comparing base (af38ee1) to head (3621b5b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19311   +/-   ##
=======================================
  Coverage   98.47%   98.47%           
=======================================
  Files         176      176           
  Lines       22845    22845           
=======================================
  Hits        22497    22497           
  Misses        348      348           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Code size report:

Reference:  samd/mphalport: Run events at least once in mp_hal_delay_ms. [af38ee1]
Comparison: stm32/boards: Add LED matrix driver for Arduino UNO Q. [merge of 3621b5b]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant