Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Configure UNO R4 WiFi to wait for post-touch port change #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
per1234 wants to merge 1 commit into arduino:main from per1234:fix-unor4wifi-wait_for_upload_port
Closed

Configure UNO R4 WiFi to wait for post-touch port change #74

per1234 wants to merge 1 commit into arduino:main from per1234:fix-unor4wifi-wait_for_upload_port

Conversation

Copy link
Collaborator

@per1234 per1234 commented Jul 28, 2023

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.
  2. Invoke the 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 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:

unor4wifi.upload.wait_for_upload_port=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 (#73).

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 10 s post-touch wait delay in all uploads that do not produce a port address change. I don't have any idea about an alternative solution that would make uploads 100% reliable while also avoiding this inefficiency.


Fixes #73

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.
Copy link
Member

facchinm commented Aug 4, 2023

However, the board's port address can change under certain conditions

That should only happen when the user is running a sketch that requires native USB I think.
For that particular use case, I'd prefer to force using the "manual" procedure (double tap on reset + select the "new" port manually before uploading)
We might think about a more sophisticated method based on the PID (that is different between a native USB and the ESP32 USB) but without harming the normal experience

Copy link
Collaborator Author

per1234 commented Aug 4, 2023

For that particular use case, I'd prefer to force using the "manual" procedure

OK, that is reasonable. I will close this as declined. In its place, I have submitted proposals to document the required "manual" upload procedure:

facchinm reacted with heart emoji

@per1234 per1234 self-assigned this Aug 4, 2023
@per1234 per1234 added type: imperfection Perceived defect in any part of project conclusion: declined Will not be worked on topic: code Related to content of the project itself labels Aug 4, 2023
pennam pushed a commit to pennam/ArduinoCore-renesas that referenced this pull request Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Upload to UNO R4 WiFi fails when "1200 bps touch" causes port change
2 participants

AltStyle によって変換されたページ (->オリジナル) /