Skip to content
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

Retry packets on timeouts and other failures #31

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

matthijskooijman
Copy link
Collaborator

In an attempt to fix Pinoccio/server-hq#191, this PR adds retries for pagedWrite commands. It's completely untested and should probably be generalized, but it might just work...

@jingman, @quartzjer, could you have a go with this code? I'm out of time for today (and probably tomorrow too).

Every command and reply in stk500 starts with 0x1b. When another byte
was received, before the serial read was aborted and an error message
was shown. However, since cbStep() doesn't do string formatting, the
variable part of the message (the actual byte received) was hidden.

This fixes that error message and continues to look for a 0x1b on an
error, which might make things slightly more reliable.
Previously, a receive timeout seemd to just end the loop, returning an
empty packet.
It seems that our bootloader times out after around 600ms, so lowering
the timeout to this ensures we get a chance to do a retry before it
times out and boots the sketch.
@matthijskooijman
Copy link
Collaborator Author

This PR also lowers the timeout to 500ms, but there's a chance that's not enough for the signon command, so that should get a higher timeout or also retries (OTOH, if the bootloader isn't running yet by the time the signon command is sent, increasing the timeout doesn't actually help, so it's probably fine like this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant