Please note that MicroPython support for the GIGA R1 is currently in an experimental phase.
To learn more about MicroPython, please visit MicroPython with Arduino. This article is specific only to the GIGA R1 board.
MicroPython is an implementation of Python in a micro format. It can be installed on the GIGA R1, where instead of compiling and uploading sketches, the board has a built-in interpreter that converts Python code to machine code in runtime.
This makes it possible to load various scripts instantly on the board, without the need of compiling the code, which is a great advantage of MicroPython.
In this article, we will guide you through the installation steps, as well as some cool tips and tricks to get creative with MicroPython on the GIGA R1.
To follow along with this guide, you will need an Arduino GIGA R1 WiFi
You will need the following software/tools installed:
*The installation for
varies between operation systems. For installation using brew.sh simply use
brew install dfu-util
1. Download the GIGAR1_MP_FW.dfu firmware.
2. Download the dfu-util tool, or install via Brew (or other package managers). Make sure it is in your PATH.
1$ brew install dfu-util
3. Double tap the reset button on the GIGA R1 board. The green LED should now be pulsing. This means it is in bootloader mode.
4. Open a terminal, and navigate to the directory of your
file. Run the following command:
1$ dfu-util -w -a 0 -d 2341:0366 -D GIGAR1_MP_FW.dfu
At the end of the process, you will see the following message on success:
1Done parsing DfuSe file
5. Reset the board by clicking the reset button (just once). You should now be able to view and access some of the GIGA R1 boards onboard storage as a mass storage device in your file manager.
Congratulations! You have now installed MicroPython on the GIGA R1 board.
To program your GIGA R1 with MicroPython, you will need an editor with support for MicroPython (such as Arduino Lab for MicroPython or Thonny).
The editors listed above are great for getting things to work quickly. One important aspect is that in the editor, you will need to connect to your board, as this will make it possible to load scripts.
As the MicroPython installation has a built-in interpreter, in the editor, you can just write a script and click on the Run Script button, and if it compiles, it will load almost instantly. You can make sure it works by running something simple, such as:
If it is printed in the REPL, it means it works, and you're ready to take on bigger challenges!
To find out examples and more fundamental knowledge, please visit the MicroPython with Arduino documentation. Here you will find an introduction to this environment and useful examples to get started.
It is important to note that different Arduino boards have different implementations. This is mainly due to what microcontroller the board is based on. For example, to access digital pin 2, on the GIGA R1, you will need to use
(with the quotation marks). See more in GIGA R1 Pin Map
The MicroPython installation exposes the mass storage device on your board, which can be edited directly from your computer. This allows you to install modules, edit the boot & main script as well as adding the possibility of switching between scripts.
You will notice that in the mass storage device, there's two
- when device loads, this script is executed. Typically you do not edit this script.
- this script executes right after
. You can consider this your classic Arduino sketch, that runs as soon your board is powered. If you want a specific program to run on your board, save it to
It is possible to add modules, drivers or scripts directly to your board. It is also as simple as dragging and dropping it into the mass storage, and
it in your script.
A really cool thing with this implementation is that you can pack the mass storage with many different scripts, and load them when needed.
This can be done using only a simple line of code:
This allows you to create a number of scripts and store it on the mass storage, and execute them from the board itself (e.g. a button).
In the table below, you will find the matching between the STM32H7 and Arduino. When writing MicroPython code, you need to use the pin designations listen in the STM32H7 column.
In this article, we have learned how to install MicroPython on the GIGA R1, using the
tool. We have also gone through some useful tips and tricks that can help you develop and run MicroPython code on your board.
For more information, visit the MicroPython with Arduino documentation.