Add function to control UART FIFO trigger levels #719
+27
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The RP2040 has a register to change the UART FIFO level at which an interrupt will be generated, but this is not exposed in the SDK. The only time it is used is within the
uart_set_irq_enablesfunction, where it is set to the minimum value. I wrote a functionuart_set_irq_fifo_levelsto configure it to any of the possible values (1/8, 1/4, 1/2, 3/4, and 7/8 full).There is a slight inconvenience that
uart_set_irq_enablesresets them to 1/8, so every time that function is calleduart_set_irq_fifo_levelsmust be called again to set the chosen values. This could potentially be fixed by removing the lines inuart_set_irq_enablesthat does this, but I didn't want to change the functionality of an existing function to keep backwards compatibility.I wrote some code to test this function, which can be found here, along with it's output.