Add function to control UART FIFO trigger levels #719

Open
nmk456 wants to merge 1 commit from nmk456/develop into develop
nmk456 commented 2022-01-27 12:55:15 -06:00 (Migrated from github.com)

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_enables function, where it is set to the minimum value. I wrote a function uart_set_irq_fifo_levels to 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_enables resets them to 1/8, so every time that function is called uart_set_irq_fifo_levels must be called again to set the chosen values. This could potentially be fixed by removing the lines in uart_set_irq_enables that 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.

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_enables` function, where it is set to the minimum value. I wrote a function `uart_set_irq_fifo_levels` to 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_enables` resets them to 1/8, so every time that function is called `uart_set_irq_fifo_levels` must be called again to set the chosen values. This could potentially be fixed by removing the lines in `uart_set_irq_enables` that 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](https://gist.github.com/nmk456/68e56a52dfa75990f447cc9a9be18c30), along with it's output.
lurch commented 2022-01-27 15:37:49 -06:00 (Migrated from github.com)

I'm not sure if they're relevant to your change here, but see also #548 and #500 and #568

I'm not sure if they're relevant to your change here, but see also #548 and #500 and #568
kilograham (Migrated from github.com) reviewed 2022-09-13 09:41:49 -05:00
kilograham (Migrated from github.com) commented 2022-09-13 09:41:49 -05:00

seems like you could do this in one hw_write_masked

seems like you could do this in one `hw_write_masked`
SPMThePlayer (Migrated from github.com) approved these changes 2024-11-01 02:24:06 -05:00
This pull request has changes conflicting with the target branch.
  • src/rp2_common/hardware_uart/include/hardware/uart.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'nmk456/develop:nmk456/develop'
git switch 'nmk456/develop'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'develop'
git merge --no-ff 'nmk456/develop'
git switch 'nmk456/develop'
git rebase 'develop'
git switch 'develop'
git merge --ff-only 'nmk456/develop'
git switch 'nmk456/develop'
git rebase 'develop'
git switch 'develop'
git merge --no-ff 'nmk456/develop'
git switch 'develop'
git merge --squash 'nmk456/develop'
git switch 'develop'
git merge --ff-only 'nmk456/develop'
git switch 'develop'
git merge 'nmk456/develop'
git push origin 'develop'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!719
No description provided.