Can't get HAL_UART_Receive_IT() to receive more than 256 bytes using standard stm32 hal functions.
I am sure I'm overlooking something simple, but I'm trying to figure how to to send 256 bytes or more using the standard uart HAL functions.
Source At This Current Point: https://github.com/mofosyne/stm32h7xx-uart/tree/41645cf33e00eb2de8438d5a04264d78cf9bb767
Dev Board Used: NUCLEO-H743ZI2
File of interest:
* /Src/uart_test.c
The main test function is a uart_ISR_test() which will continuously request a certain amount of data from `./stm32_impulse_test.py`. Ergo you can use the below commands...
```
# Load and run test on micro
make swd
# Turn on swo viewer
./swo_parser.py
# Send test data to device
./stm32_impulse_test.py /dev/tty.usbmodem14403
```
So what I found is that when I modify both the python script and the firmware rx buffer size. I can receive any data below 256 bytes. But have problem getting 256 or more bytes.
## For hal uart rx buffer size of 256-12
```
I: ************************* Rx *********************************
E: Rx Received (HAL_OK)
I: Got 244 valid bytes
I: Rx :
0 | 01 02 03 04 05 06 07 08 09 01 02 03 04 05 06 07
16 | 08 09 01 02 03 04 05 06 07 08 09 01 02 03 04 05
32 | 06 07 08 09 01 02 03 04 05 06 07 08 09 01 02 03
48 | 04 05 06 07 08 09 01 02 03 04 05 06 07 08 09 01
64 | 02 03 04 05 06 07 08 09 01 02 03 04 05 06 07 08
80 | 09 01 02 03 04 05 06 07 08 09 01 02 03 04 05 06
96 | 07 08 09 01 02 03 04 05 06 07 08 09 01 02 03 04
112 | 05 06 07 08 09 01 02 03 04 05 06 07 08 09 01 02
128 | 03 04 05 06 07 08 09 01 02 03 04 05 06 07 08 09
144 | 01 02 03 04 05 06 07 08 09 01 02 03 04 05 06 07
160 | 08 09 01 02 03 04 05 06 07 08 09 01 02 03 04 05
176 | 06 07 08 09 01 02 03 04 05 06 07 08 09 01 02 03
192 | 04 05 06 07 08 09 01 02 03 04 05 06 07 08 09 01
208 | 02 03 04 05 06 07 08 09 01 02 03 04 05 06 07 08
224 | 09 01 02 03 04 05 06 07 08 09 01 02 03 04 05 06
240 | 07 08 09 01
```
## For hal uart rx buffer size of 256+12
```
I: ************************* Rx *********************************
E: Rx Timeout (HAL_OK)
E: Got only 12 valid bytes out of 268
I: Rx :
0 | 01 02 03 04 05 06 07 08 09 01 02 03 01 02 03 04
16 | 05 06 07 08 09 01 02 03 00 00 00 00 00 00 00 00
32 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
48 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
64 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
96 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
112 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
128 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
144 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
176 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
192 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
208 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
224 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
256 | 00 00 00 00 00 00 00 00 00 00 00 00
```
## For hal uart rx buffer size of 256
```
I: ************************* Rx *********************************
E: Rx Timeout (HAL_OK)
E: Got only 0 valid bytes out of 256
I: Rx :
0 | All 00 (256 Bytes)
```
---------------------------
Btw this is what my reg initially looks like for (256-12) buffer size...
I: Uart Test Start
I: 0: ghwuart_ptr->Instance->CR1 = 0000000D : USART Control register 1
I: 0: ghwuart_ptr->Instance->CR2 = 00000000 : USART Control register 2
I: 0: ghwuart_ptr->Instance->CR3 = 00001000 : USART Control register 3
I: 0: ghwuart_ptr->Instance->BRR = 00000364 : USART Baud rate register
I: 0: ghwuart_ptr->Instance->GTPR = 00000000 : USART Guard time and prescaler register
I: 0: ghwuart_ptr->Instance->RTOR = 00000000 : USART Receiver Time Out register
I: 0: ghwuart_ptr->Instance->RQR = 00000000 : USART Request register
I: 0: ghwuart_ptr->Instance->ISR = 006000D0 : USART Interrupt and status register
I: 0: ghwuart_ptr->Instance->PRESC = 00000000 : USART clock Prescaler register
I: (0) USART_CR1_UE bit set : USART Enable
I: (0) USART_CR1_RE bit set : Receiver Enable
I: (0) USART_CR1_TE bit set : Transmitter Enable
I: (0) USART_CR3_OVRDIS bit set : Overrun Disable
Then
I: 1: ghwuart_ptr->Instance->ISR = (006000D0 --> 006010D0) : USART Interrupt and status register
I: (1) USART_ISR_EOBF bit set : End Of Block Flag
-------
For 256 bytes rx...
```
I: Uart Test Start
I: 0: ghwuart_ptr->Instance->CR1 = 0000000D : USART Control register 1
I: 0: ghwuart_ptr->Instance->CR2 = 00000000 : USART Control register 2
I: 0: ghwuart_ptr->Instance->CR3 = 00001000 : USART Control register 3
I: 0: ghwuart_ptr->Instance->BRR = 00000364 : USART Baud rate register
I: 0: ghwuart_ptr->Instance->GTPR = 00000000 : USART Guard time and prescaler register
I: 0: ghwuart_ptr->Instance->RTOR = 00000000 : USART Receiver Time Out register
I: 0: ghwuart_ptr->Instance->RQR = 00000000 : USART Request register
I: 0: ghwuart_ptr->Instance->ISR = 006000D0 : USART Interrupt and status register
I: 0: ghwuart_ptr->Instance->PRESC = 00000000 : USART clock Prescaler register
I: (0) USART_CR1_UE bit set : USART Enable
I: (0) USART_CR1_RE bit set : Receiver Enable
I: (0) USART_CR1_TE bit set : Transmitter Enable
I: (0) USART_CR3_OVRDIS bit set : Overrun Disable
I: ************************* Rx *********************************
E: Rx Timeout (HAL_OK)
E: Got only 0 valid bytes out of 256
I: Rx :
0 | All 00 (256 Bytes)
... next rx cycle
I: 1: ghwuart_ptr->Instance->CR1 = (0000000D --> 0000012D) : USART Control register 1
I: 1: ghwuart_ptr->Instance->CR3 = (00001000 --> 00001001) : USART Control register 3
I: ************************* Rx *********************************
E: Rx Timeout (HAL_OK)
E: Got only 0 valid bytes out of 256
I: Rx :
0 | All 00 (256 Bytes)
```
--------------------
I am also curious how everyone approaches uart rx. Do they only just use HAL_UART_Receive_IT() but just throw it into a software FIFO pipe?
If I am recommended to just skip the HAL and just rewrite it myself that is alright as well. Just needs some pointers
