DEV Community

Cover image for Zephyr on Arduino UNO Q MCU
Daniel Guerrero
Daniel Guerrero

Posted on

Zephyr on Arduino UNO Q MCU

The Arduino UNO Q have a STM32U585 inside doing all the Arduino stuff, it communicates with main processor and GPIO pins on board; it seems the only way to get a pinout is the schematics:
https://docs.arduino.cc/resources/schematics/ABX00162-schematics.pdf

The pinout image have brief information about the MCU pins
Arduino UNO Q Pinout
Source

But only shows that pins belong to MCU, and the only indication are on RGB LED 3 and 4 that shows the GPIO used for the MCU.

For this example it will be needed:

  • Zephyr (on the PC Host, probably can be reused the version in UNO Q)
  • ADB tools (to connect to the device from PC Host)

Zephyr

You need to install / update Zephyr. Is important to have at least version 4.3.0 as that is the first version with support

Compile example

It can be used the blinky example directly from documentation:

# use the path to your zephyr setup
cd ~/zephyrproject/zephyr
west build -p always -b arduino_uno_q samples/basic/blinky
Enter fullscreen mode Exit fullscreen mode

Upload to device

Once compiled it needs to be copied to UNO Q device using adb:

adb push build/zephyr/zephyr.elf /tmp/
Enter fullscreen mode Exit fullscreen mode

Flash MCU

The only remaining step is to flash the STM32 MCU this can be done with the tools already installed in the UNO Q

adb shell

# following commands must be in the UNO Q
# paths are hardcoded but should work
# probably some paths needs to be updated with proper versions
/home/arduino/.arduino15/packages/arduino/tools/remoteocd/0.0.4-rc.4/remoteocd \
    upload \
    --adb-path "/home/arduino/.arduino15/packages/arduino/tools/adb/32.0.0/adb" \
    -s "{upload.port.properties.serialNumber}" \
    -f "/home/arduino/.arduino15/packages/arduino/hardware/zephyr/0.52.0/variants/arduino_uno_q_stm32u585xx/flash_bootloader.cfg" \
    "--verbose" \
    /tmp/zephyr.elf
Enter fullscreen mode Exit fullscreen mode

If everything is fine, the LED3 will blink with a green color

Restoring Sketch Bootloader

If you use Arduino App Lab and try to upload a new sketch, you will notice there will be error on uploading, this is because the MCU contains a called "Sketch Bootloader" and the sketch code is added on top of that.
But the Arduino UNO Q have the commands to restore:

arduino-cli burn-bootloader -b arduino:zephyr:unoq -P jlink
Enter fullscreen mode Exit fullscreen mode

With this command will upload the Sketch Bootloader so you can upload code from the App Lab. Nice!

References

Top comments (0)