-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drivers/at: improve URC handling #14914
base: master
Are you sure you want to change the base?
Conversation
According to the ublox cellular modem AT reference manual, a delay of -at least- 20ms is required before starting a new command operation so that the modem has time to send the stored URC messages to the host. It is also important to note that this delay is inserted just BEFORE draining the AT device so as to receive and process possible URCs. Another point to keep in mind is that this delay is put in functions which constitute a whole AT command, i.e. sending the command and waiting for the answer. The remaning functions like at_send_bytes or at_recv_bytes do not have this delay. The users, who will use those functions in their own implementation, are advised to respect this timing.
With this commit, we attempt to fix some URC missing failures that we have experienced so far. According to the basic test results with the ublox SARA modem, these changes seem to be promising. However, we need more detailed testing to come up with a final conclusion.
@leandrolanzieri do you think you can find time to have a look at this one ? |
Can you provide some test output @vincent-d ? |
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.
A few comments, if you provide some test results we can move forward with this one @vincent-d.
@@ -210,6 +269,7 @@ ssize_t at_send_cmd_get_resp(at_dev_t *dev, const char *command, | |||
{ | |||
ssize_t res; | |||
|
|||
xtimer_usleep(AT_CMD_DELAY); |
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.
xtimer
is added but not as a dependency to the driver (you might consider using ztimer
as well)
return rb->buf[rb->reads & (rb->size - 1)]; | ||
} | ||
|
||
int tsrb_peek_one(tsrb_t *rb, uint8_t *dst) |
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.
Can you add a test for this in test-tsrb.c
?
ping @vincent-d |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
I will try to finalize this PR. |
Contribution description
Those changes improved our situation regarding URC with our modem.
main changes:
at_drain()
at_expect()
Rationale: a URC can be emitted while a command is being sent before the echo is received.
The credit (and hopefully the support for this PR ;p ) goes to @aaltuntas