2019-07-17 05:55 PM
Hello again!
I've got (another) weird problem working with both H743 and H750 (rev X and rev V). Here is my setup:
SYSCLK = 400 MHz (from HSI RC)
UART8 = 100 MHz, Async mode, only RX/TX, 19200-8-1-N
USART1 = 100 MHz, Async mode, only RX/TX, 19200-8-1-N
USART6 = 100 MHz, Async mode, only RX/TX, 9600-8-1-N
Init and Transmission using HAL 1.4.0
Reception using IRQHandler (verifying RXNE bit, getting RDR register to a rotation buffer)
Preemption 1 for each UART and Sub as 0, 1 and 2
USART1 and USART6 always TX around 10 bytes each 1 second, in this test, no RX.
UART8 can TX and RX up to 1500 bytes to/from a PC, in a single shot
Everything works fine with UART8 sending 1500 bytes and receiving around 100 bytes. But increasing the PC package, gives me an overrun error (ORE bit). Even with FIFO enabled (and a "while" in IRQ checking RXNE bit), the overrun occurs.
So here comes the odd behavior:
1) Setting UART8 baudrate to 115200 bps, still sets ORE, but fewer times than 9600;
2) Setting UART8 baudrate to 9600 bps, no ORE even for 1500 bytes from PC;
3) Setting UART8 baudrate to 19200 bps and setting USART1 baudrate to 9600 bps, no ORE even for 1500 bytes from PC;
4) Setting UART8 baudrate to 9600 bps and setting USART1 baudrate to 9600 bps, ORE for any big package.
As you can see, somehow, the USART1 baudrate is affecting UART8 reception. I also tried to give each UART a different preemption, even checked registers from both and nothing wrong!
Is anyone here with the same issue? Or can simulate on a dev kit?
Thanks again!
2019-07-17 08:16 PM
What do you do in the IRQ Handler and callbacks it ends up calling? I would avoid data processing.
Is the NVIC Group setting correct?
I'm not wedded to the HAL, the USART implementation is a bit heavy, so not something I will invest time into.
One could arguably have a single IRQ Handler, prioritized at the same level, that cycles all USART, queuing/buffering data for a lower priority task to digest.
Minimally, I'd try to figure out what's eating up time. Make sure it is not spinning waiting for a TXE/RXNE that might eat a whole byte time interval.
2019-07-18 10:13 AM
Hi Clive
Yes, NVIC is set to Group 2 (2/2 bits). I'm not using HAL callback, UARTx_IRQHandler calls my own method, which checks ORE and RXNE bits, as following:
void myUART8handler(void)
{
// Overrun Error
if (__HAL_UART_GET_FLAG(&huart8, UART_FLAG_ORE) != RESET)
{
__HAL_UART_CLEAR_FLAG(&huart8, UART_CLEAR_OREF);
//uint16_t error_d = (huart8.Instance->RDR);
//return;
}
// RX Interrupt
if( (__HAL_UART_GET_IT(&huart8, UART_IT_RXNE) != RESET)&&
(__HAL_UART_GET_IT_SOURCE(&huart8, UART_IT_RXNE) != RESET) )
{
#ifdef __UART_8_USING_FIFO
while( __HAL_UART_GET_FLAG(&huart8, UART_FLAG_RXFNE) )
#endif
{
verifyUART8pointer();
*(pRxUART8_HEAD++) = (huart8.Instance->RDR & 0x00FF);
toutRxUart8_1ms = 10;
}
}
}
"pRxUART8_HEAD" points to a global "uint8_t v[1500]" and "verifyUART8pointer()" only checks the rotation buffer. "toutRxUart8_1ms" decrease in Systick, so when it's 0, "main" can use the received data frame.
But remember, I'm only having trouble when both UART8 and USART1 have the same baudrate!