From 314b5deb6dde21857dba51b1ed193a5eecd1f696 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 27 Jul 2023 21:58:35 -0700 Subject: [PATCH] Configure UNO R4 WiFi to wait for post-touch port change The upload operation for the UNO R4 WiFi follows this sequence: 1. Perform a "1200 bps touch" to put the board into the mode where it can be flashed. 1. Invoke the `bossac` command that flashes the binary. 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 the `upload.wait_for_upload_port` property to `false` 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 was set to `false`. However, the board's port address can change under certain conditions and this caused the `bossac` command invocation to fail with a "No device found on ..." error because of the original port address being used in the generated command instead of the post-touch address. This spurious upload failure is avoided by changing the value of the `upload.wait_for_upload_port` property to `true`. Note that this does have the unfortunate side effect of introducing the post-touch wait delay in all uploads that do not produce a port address change. --- boards.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards.txt b/boards.txt index 77fb320f8..e2e6a976b 100644 --- a/boards.txt +++ b/boards.txt @@ -135,7 +135,7 @@ unor4wifi.upload.transport= unor4wifi.upload.vid=0x2341 unor4wifi.upload.pid=0x1002 unor4wifi.upload.use_1200bps_touch=true -unor4wifi.upload.wait_for_upload_port=false +unor4wifi.upload.wait_for_upload_port=true unor4wifi.upload.native_usb=true unor4wifi.upload.maximum_size=262144 unor4wifi.upload.maximum_data_size=32768