Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: serial: nrfx_uarte: Rework driver to support new features #78887

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Oct 15, 2024

  1. drivers: serial: nrfx_uarte: Refactor to use RX async struct pointer

    Refactor RX asynchronous API function to use a pointer to the RX
    async data structure instead of top level data structure pointer.
    It improves readability with more concise code.
    
    Signed-off-by: Krzysztof Chruściński <[email protected]>
    nordic-krch committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    066d06a View commit details
    Browse the repository at this point in the history
  2. drivers: serial: nrfx_uarte: Rework driver to support new features

    Rework driver to support new way of asynchronous RX handling.
    Previously RX was handled in two modes: using RXDRDY interrupt for byte
    counting or TIMER + PPI. Both modes had flaws. RXDRDY interrupt mode
    could miscalculated amount of received bytes when interrupt was not
    handled on time. Data was not lost but was not reported on time that
    could lead to issues. PPI+TIMER mode requires additional resources
    thus it was not the default mode. Often user was not aware of that
    option and was expiriencing driver RX faults.
    
    New RX mode is switching buffers when there is new data (RXDRDY event
    not set for given amount of time). It does not require additional
    resources to get precise byte counting. Additionally, this is in line
    with new UARTE feature (RX frame timeout) which is present in nRF54X
    devices. The behavior of the driver is the same for legacy devices
    and new one. For legacy devices k_timer periodic interrupts are used
    to check if there are any new bytes and it is not needed when RX frame
    timeout is present.
    
    Improved RX mode is enabled by default
    (CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y) but legacy modes are still
    available though not recommended to be used.
    
    Note that new RX mode behaves a bit different because timeout always
    triggers switch of buffers which means that there will be no
    UART_RX_RDY events with non-zero offset. It also means that every
    UART_RX_RDY will be followed by UART_RX_BUF_RELEASED.
    
    After rework, driver is recommended to be used for all platforms as it
    performs much better and takes much less code than the second UART shim
    available for Nordic devices.
    
    Signed-off-by: Krzysztof Chruściński <[email protected]>
    nordic-krch committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    1816453 View commit details
    Browse the repository at this point in the history
  3. drivers: serial: nrfx_uarte: Add support for frame timeout

    Frame timeout is a hardware feature present in newer versions
    of UARTE (e.g. in NRF54X platforms) for detecting idle state
    on RX line and ending RX after configurable timeout.
    
    Signed-off-by: Krzysztof Chruściński <[email protected]>
    nordic-krch committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    812e4d8 View commit details
    Browse the repository at this point in the history