[STM32F7] What could be a reason that HAL_UART_Receive_IT does not return?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 10:36 AM
The corresponding UART works fine with HAL_UART_Receive. I've confirmed with GDB that this function fails to return. I realize I'm leaving out a lot of details here, but from the documentation I can see a lot of reasons why this function can *fail*, and a lot of ways one can screw up the handling of the interrupts, but I fail to understand how the function could just block and not return.
Any hints?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 12:00 PM
Could be an ISR starving it of resources. Easy enough to debug and check what's going on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 12:02 PM
Thanks! Do you have any hints as to how I might want to proceed? I believe the only interrupt I'm dealing with is a tick timer, as set up automatically by the CubeMX code generator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 12:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 01:39 PM
That's what I'm doing. I can only see I'm stuck at the call to HAL_UART_Receive_IT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-07 01:44 PM
Single-step in disasm.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-08 12:45 AM
Most likely the problem is something else. For example wrong flash latency, voltage scale, overdrive mode, clock frequency.
P.S.
huart->RxISR = NULL;
/* Computation of UART mask to apply to RDR register */
UART_MASK_COMPUTATION(huart);
...
/* Set the Rx ISR function pointer according to the data word length */
if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
{
huart->RxISR = UART_RxISR_16BIT;
}
else
{
huart->RxISR = UART_RxISR_8BIT;
}
Although the configuration itself is changed only at initialization, all of this junk is done at every transaction...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-10 01:53 AM
Ugh, yeah, I keep hearing horror stories of the HAL. Do you happen to know of a good, introductory-level example of doing UART communication without using the HAL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-10 02:35 AM
I'm guessing this is now quite off-topic, but am I supposed to be able to `stepi` with GDB over st-link? Every time I try, the code just seems to run until I hit HAL_UART_Receive_IT (which is definitely a little while into the program), and then hang.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-10 02:35 AM
That's what I'm doing. I can only see I'm stuck at the call to HAL_UART_Receive_IT. (Sorry if this is a double-post; I can't tell if my previous reply was actually put in the right place.)