-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(init-reset): implemented small state machine for link opening and reset #9
Conversation
…d reset Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
src/lib.rs
Outdated
break; | ||
} else if hdr.has_r_flag() { | ||
// we received a reset we must resend the init message after a small sleep | ||
tokio::time::sleep(Duration::from_micros(SERIAL_CONNECT_THROTTLE_TIME_US)).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this sleep really necessary?
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
Guys, I am sorry for the headache, but it is clearly seen from the diagram that the behavior of the Connect side does not depend on the state of the flags in the new header field (the "H" byte). If the connect request is successful, data transfer begins. If not, the Connect side keeps trying. In other words, the H byte is useless. :-( |
src/lib.rs
Outdated
log::trace!("Received header: {hdr:02X?}"); | ||
if hdr.has_i_flag() { | ||
// we send back a message with both I and A flags | ||
self.internal_write(&[0u8], Header::new(I_FLAG | A_FLAG)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not an empty payload, but payload with length 1, but according to the format we expected length 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, but we do not even check the payload. Its indeed a payload with lenght 1 and a single 0 byte.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't check the payload here, but in pico the message is read in its entirety, and for this a buffer is needed, for connection messages I would prefer not to allocate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to fix it.
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
Initializaiton message exchange from cold start
If connect sides restarts: