-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers/at: Add at_urc_isr module to process URCs upon arrival #14327
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
Conversation
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.
Code looks good, except the small nit I just found.
Do you have a way to test this and report in the PR ? (I have no access to AT based devices ATM).
I have pushed a fixup because I was getting an error return code when sending the commands, also the stack size of the event thread was too small to use
I tested with the UBLOX sara-r410m. You can see that I registered an URC with the response of the scan, which takes several seconds. Then I issued the command to scan (which times out). Finally I get the message and it's reported as a received URC. Also immediate commands still work as usual.
|
Sorry to only think about this now. I'm wondering if we could avoid the use of the event thread, since this adds another thread. Maybe that's not possible, since directly calling the callback when the URC would be done in ISR context if I understand it correctly. |
Yeah, this is the main reason why I am using event thread. I think in this case it's ok to use these types of OS mechanisms for offloading. That being said, another alternative could be that the user initializes the event queue and handles the even loop? Maybe even chose the behaviour using pseudomodules. |
That would move the complexity in the user code. I'm not sure that's very friendly for this kind of things. Since this part is only build when enabling the URC isr I think this is fine. Please address my remaining comments and squash directly ! |
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.
ACK
Please squash!
1d3e851
to
955efd8
Compare
@aabadie squashed. Thanks for reviewing! |
Travis failed and I can't restart it but that's not a problem since Murdock is green => GO! |
Hello, I am not sure if I am allowed to directly jump into the conversation -I am not a contributor just an ordinary RIOT user :)- but I could share a useful experience with you although the PR has just been merged:). In our FW, we communicate with ublox modems using this at driver. We have spent considerable amount of time in properly processing all emitted URCs. According to our observations by means of a logic analyzer, it's really hard to decide when the AT device will NOT send a URC. We have observed cases in which we send out an AT command and the first thing that we receive is a URC. Then the response of the command follows. It might sound weird but this is how the ublox modem behaves. That being said, I am not so confident that this implementation will guarantee to capture all emitted URCs. |
@leandrolanzieri what do you think ? Did you encounter such problems with your ublox driver ? |
Not so far, but if the behaviour is as @aaltuntas describes (having URCs in the middle of commands) it is possible that we do not catch all URCs with just the interrupt. I will keep an eye on that while I continue with the driver. @aaltuntas do you have any suggestions for improvement here? |
Our approach was not event based, we refactored So, keeping those in mind, I would suggest to put |
Contribution description
This adds the
at_urc_isr
pseudomodule to the AT driver. This module allows to trigger the processing of registered URCs whenAT_EOL_RECV_2
character is detected (and no response is pending). It makes use of event threads to process the buffer and call the callback function.Testing procedure
tests/driver_at
application and register an URC. When the URC arrives the notification should be displayed without having to manually process it. All the other functionalities of the driver should still work as usual.at_urc_isr
byat_urc
in the application and now manually processing should be needed.Issues/PRs references
None.