Uploading directly to the QT Py USB port is very convenient. However, if you find that your COM port disappears or you're working on HID device code, then you may need to utilize uploading code in bootloader mode.
You can get your QT Py CH552 into bootloader mode by unplugging the USB port, holding down the Boot button and plugging the USB cable back in. There is a catch though: the chip does not stay in bootloader mode for very long. You only have a few seconds to talk to the bootloader. As a result, timing is everything.
Bootloader mode is the only way you can reprogram the chip after uploading HID code that is compiled with the USER CODE
USB settings. It's also needed if bad code is uploaded that makes the COM port unreachable.
The CH552 does not stay in bootloader mode for very long. You only have a few seconds to talk to the bootloader.
Blink to the Rescue
Blinking an LED is not only a great place to start with new hardware, it's also a great reset point; like a save state. You'll upload the blink example to the QT Py in bootloader mode.
After opening the sketch in the Arduino IDE, click on the Verify checkmark to compile the code. This will save some time when uploading the code to the board.
Next, unplug the USB cable from the QT Py. Press and hold the Boot button but do not plug the board back in yet.
Begin the upload process without the QT Py plugged in by clicking the Upload button in the Arduino IDE. You'll see the progress at the bottom of the IDE window.
When you see Compiling libraries...
and Compiling core...
in the progress output, plug in the QT Py while still holding down the Boot button.
If you're successful, you'll see the Reset OK
message in red at the bottom of the window. If you connect an LED to the MISO pin, you should see it blinking.
After this process, you should see your CDC Serial COM port return as a Port option in the Arduino IDE. Using this method you can iterate when working on HID device code without worrying about losing the CDC Serial port.
Linux Troubleshooting Steps
If you are on Linux and find that these instructions don't work for you, try these additional steps. In the terminal enter:
cd /etc/udev/rules.d sudo touch 99.ch55xbl.rules sudo vi 99.ch55xbl.rules
In the rules file, copy and paste the following into the file:
# CH55x bootloader # copy to /etc/udev/rules.d/ SUBSYSTEM=="usb", ATTRS{idVendor}=="4348", ATTRS{idProduct}=="55e0", MODE="0666"
Then, save changes and reboot your system. This should allow access to the QT Py.
Text editor powered by tinymce.