Upload to UNO R4 WiFi fails when "1200 bps touch" causes port change #73
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
The upload operation for the UNO R4 WiFi follows this sequence:
bossac
command that flashes the binary to the board.It is common for the address of the board port to change after the "1200 bps touch" step and so the Arduino development tools have a system for detecting the post-touch address and using that address when the upload command is generated from the "pattern" defined for the board in
platform.txt
. That system involves a post-touch wait to watch for the new port to appear before eventually timing out and resorting to the fallback behavior of using the original address to the upload pattern if no address change was detected. Since some boards will never produce a post-touch address change (meaning the post-touch wait step would only cause an unnecessary delay in the upload operation) it is possible to configure the board to skip the wait step by setting theupload.wait_for_upload_port
property tofalse
in the board definition.The assumption was made that the address of the UNO R4 WiFi board's port will never experience a post-touch address change, so its
upload.wait_for_upload_port
property is set tofalse
ArduinoCore-renesas/boards.txt
Line 149 in f032b82
However, the address can change under certain conditions. When the address does change, it causes the
bossac
command invocation to fail with a "No device found on ...
" error because the original port address is used in the generated command instead of the post-touch address.To reproduce
Arduino IDE
the upload should be successful as long as the board isn't already running a problematic sketch.
🐛 The upload fails:
Arduino CLI
Setup
Demo
Expected behavior
Correct port address is always used in the upload command.
Project version
Original report
e5ab698
Last verified with
f032b82
"Bridge" firmware version: 0.5.2
Operating system
Operating system version
Additional context
For the sake of simplicity, I used the the low level "HID" library in the demonstration sketch, but that library is not commonly used directly in real world sketches. However, it is common to use the "Keyboard" or "Mouse" libraries, which have a dependency on the "HID" library and are documented as supported for use with the UNO R4 WiFi:
https://docs.arduino.cc/tutorials/uno-r4-wifi/usb-hid
The fault will also occur when using either of those libraries in a sketch:
The distinctive "
Cannot perform port reset: TOUCH: error during reset: opening port at 1200bps: Invalid serial port
" error message shown in the upload output from the demo only occurs on Windows machines. On Linux and macOS machines, the "touch" doesn't produce an error message and the only error message is the ambiguous "No device found on ...
".Originally reported at https://forum.arduino.cc/t/failed-uploading-after-upload-usb-hid-example/1151778
Additional reports
Workaround
You should now see the "L" LED pulsing.
❗ The double reset you did in step (3) can cause the port number of the board to change, so don't assume you already have the correct port selected.
The text was updated successfully, but these errors were encountered: