Microcontroller programming
Libraries and software components used
The software for the microcontrollers has been developed utilizing Arduino and Teensyduino tools and frameworks. The software is utilizing the libraries documented in the table below.
Portions of the MC1 software is based on the work of The FreeTypeProject. All rights reserved.
Preparing the software environment on your computer
For the installation of the Arduino IDE, please refer to https://www.arduino.cc/en/software and follow the instructions for your respective target platform.
A few more steps are necessary for the Teensy: Please refer to https://www.pjrc.com/teensy/tutorial.html and continue with the next step after the “Install Arduino IDE Software”.
Flashing the firmware
You have received two binary files that represent the firmware for the microcontrollers. They need to be uploaded with the respective development tools.
Therefore, the MyGamepad device needs to be connected to the computer with the USB-A connector.
Arduino Nano ESP32 (MC1)
Preparing the bootloader and file system
Before installing the MyGamepad firmware for the first time, a special procedure must be followed to prepare the internal file system of the Arduino Nano ESP32. This procedure is described here: https://docs.arduino.cc/tutorials/nano-esp32/spiff/. Please follow the outlined steps closely, including uploading and running the SPIFFS_Test example. The MyGamepad firmware requires a proper setup of the SPIFFS partition (advanced) of the microcontroller.
How to find the necessary dfu-util tool
​
The dfu-util tools is required to transfer a binary firmware to the microcontroller. It will be installed with the Arduino IDE. However, the exact location may vary depending on your operation system and user account setting.
An easy way to find this is to activate the option “Show verbose during compile and upload” in the Arduino IDE settings/preferences (see figure below).
When compiling and uploading the required SPIFFS_Test example as descried in the previous paragraph, it will show the dfu-util tool path in the output (see figure below).
Uploading the firmware
Open a command line shell (Terminal on Mac or CMD.exe on PC) window and enter the following command, while MyGamepad is connected.
“<TOOL-PATH>/dfu-util” --device 0x2341:0x0070 -D “<FIRMWARE-PATH>/MyGamepad_MC1_ESP32.ino.bin”
Replace <TOOL-PATH> with the right path as described above in "How to find the necessary dfu-util tool" and <FIRMWARE-PATH> with the path where you stored the firmware.
​
On Windows based PCs the "dfu-util" tool is named "dfu-util.exe"
​
NOTICE: In case the upload is getting interrupted, press the reset button of the Arduino Nano EPS32 twice with approximately half a second break in between. When the RGB LED is slowly flashing green start the upload.
Teensy 4.0 (MC2)
Uploading the firmware
​
The upload process is easier for the Teensy. Open the Teensy App on Mac or Teensy.exe on PC.
​
Open the file “<FIRMWARE-PATH>/MyGamepad_MC2_Teensy40.ino.hex” and select in the menu operation->program.
​
NOTICE: The MyGamepad firmware will setup the Teensy 4.0 in controller/Xinput, mode which makes it invisible for the USB device selection. After the first upload, there are two more steps that must be followed: Deactivate the “Automatic” function in the Teensy App and open the MyGamepad base housing and press the reset button on the Teensy microcontroller to put it into program mode.