I have a STM32L4xx series microcontroller. My goal is to use RTO in USART to issue a timeout, from the time a read was attempted (not only from the last stop bit). This is needed as its possible for nothing to be received. How do I acheive this using RTO?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-21 9:57 PM
I've setup USART to interrupt on a timeout using:
CR2.RTOEN
CR1.RTOIE
And configured the timeout using:
RTOR.RTO
It works great, really nice feature. The RTO timeouts are always measured from the last stopbit/character received. However, I need to support a timeout even if zero characters were received. Does anybody know of a method to reset the RTO counter etc?
- Labels:
-
STM32L4 series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-21 10:53 PM
I doubt that RTO can be used for that. A simplistic approach would be using HAL_UART_Receive with a small timeout value (SysTick). A more sophisticated approach could start a timer and use a timer interrupt when the time is over.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-23 6:38 AM
For "no reception" timeout typically a notification/event/semaphore wait function or other independent software/hardware timeouts are used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-23 7:19 PM
I thought that might be the case. Was looking for a dependable workaround to keep timeout functionality to the peripheral itself (just seemed like more modular design).
Appreciate the responses. Shame its not possible, honestly it seems like a trivial change to the functionality (force manual triggering of a stop bit). That said, I understand that'd be a respin of silicon and thats just not going to happen :(
Does anybody know if using internal pull-ups and bitbanging a USART rx to a stopbit would work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-23 11:38 PM
>using internal pull-ups and bitbanging a USART rx to a stopbit
Surely the connected device pulls stronger than the pull-ups. And if not, you're risking corruption of genuinely incoming data.
> Shame its not possible, honestly it seems like a trivial change to the functionality
You can start an "Idea", maybe it'll stick, at least for future devices.
Meantime, just accept the status quo, as Piranha and KnarfB said.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-15 3:37 PM
thanks!
