2024-09-11 03:42 AM - last edited on 2024-09-11 03:53 AM by Andrew Neil
Hi
The MCU is a STM32H735
I will use the UART3 port for combined debug output and command line interface
So I would like to use the FIFO, it quite useful when sending debug data.
The Fifo is also useful for RX, if e.g. interrupt is blocked by other interrupt with higher priority
But I would like to have interrupt on every byte that I receive. That's needed for the command line interface where I echo and edit, finish, recall commands.
I have not been able to configure it like this.
I do not need to use the Hall libraries, I can just implement a simple ring-buffer myself.
Is it possible to both use the Fifo and have interrupt on every bytes received?
Best Regards
Kristian Vang
Solved! Go to Solution.
2024-09-11 01:41 PM
Thanks for the inputs :)
I figured it out myself, the UART has separate interrupt flags for both Data available (RX) Empty(TX) Fifo levels.
So i was just a matter of enabling the correct flags
Now I can have it running as I want by interrupt alone.
__HAL_UART_ENABLE_IT(m_huart, UART_IT_RXNE); // Enable RX interrupt
__HAL_UART_ENABLE_IT(m_huart, UART_IT_TXE); // Enable TX interrupt
2024-09-11 03:56 AM
Having an interrupt on every received byte seems to defeat the object of a FIFO?
:thinking_face:
@Kvang wrote:The Fifo is also useful for RX, if e.g. interrupt is blocked by other interrupt with higher priority
But you said the RX is for a CLI - so a human typing at a terminal?
Humans don't type fast (in microcontroller terms) - so this seems unlikely to be an issue?
Can you configure the UART with FIFO on TX only (not RX) ... ?
2024-09-11 05:06 AM
Probably you need here the receive timeout interrupt (RTO). It will allow receiving single characters even in FIFO mode.
2024-09-11 01:41 PM
Thanks for the inputs :)
I figured it out myself, the UART has separate interrupt flags for both Data available (RX) Empty(TX) Fifo levels.
So i was just a matter of enabling the correct flags
Now I can have it running as I want by interrupt alone.
__HAL_UART_ENABLE_IT(m_huart, UART_IT_RXNE); // Enable RX interrupt
__HAL_UART_ENABLE_IT(m_huart, UART_IT_TXE); // Enable TX interrupt