nRF54L15 UART RX Stall during Flash Write (S32K344 to nRF54 OTA)

Environment:

  • nRF Connect SDK (NCS): v3.1.0

  • Hardware: nRF54L15 (Custom/DK)

  • External MCU: S32K344 (sending data via UART @ 115200 baud)

  • Toolchain: Zephyr OS v4.1.99

Issue Description: I am implementing a custom UART-based OTA update. An S32K344 sends a binary image (approx. 50KB) to the nRF54L15 in chunks(chunk size: 256 bytes). The nRF54 receives these chunks via an interrupt-driven UART driver and writes them to the secondary slot using the flash_img API.

The transfer starts correctly, but it consistently stalls before completion. For example, in a 50,044-byte transfer, the logs show it hanging at exactly 39,931 bytes. Attached the config files and log screenshot for reference.

Symptoms Observed:

  1. Data Corruption/Ghost Bytes: Even with error clearing, I occasionally see the rx_len jumping by 257 or 258 bytes when 256 were expected, suggesting framing or overrun issues.

  2. Flash Latency: The stall appears to happen because the flash_img_buffered_write operation takes long enough to cause the nRF54's internal UART FIFO to overflow while the S32K344 continues to stream data.

Current ISR Implementation:

void uart_cb(const struct device *dev, void *user_data) {
        if (!uart_irq_update(dev)) return;

       // Clearing errors to prevent interrupt loop
       int err = uart_err_check(dev);

       while (uart_irq_rx_ready(dev)) {
                 uint8_t temp[64];
                 int len = uart_fifo_read(dev, temp, sizeof(temp));
                 if (len > 0) {
                    // Buffer management logic here...
                 }
        }
}

Questions:

  1. Is it expected that the nRF54L15 UART FIFO will overflow during active flash writes at 115200 baud without hardware flow control?

  2. I am planning to enable RTS/CTS (Hardware Flow Control). Does the nRF54L15 UART peripheral handle RTS de-assertion automatically at the hardware level when the FIFO is nearly full, or do I need to manage the RTS pin manually in software when the flash write starts?

  3. Are there specific Kconfig optimizations for the nRF54 series to prioritize UART ISRs over flash write operations to prevent data loss?

    nrf54l15dk_nrf54l15.overlay4370.prj.conf0160.sysbuild.conf

  • Hello,

    When using the interrupt driven API you generally need flow control to support reliable reception. Is there anything preventing you from enabling HW flow control with your current HW? I see you have commented the "hw-flow-control" property in your overlay and not specified the CTS/RTS pinout in the pinctrl node.

    Best regards,

    Vidar

  • Hello,

    Thank you for the observation. I have now enabled Hardware Flow Control (RTS/CTS) in both the pinctrl and the UART node in my overlay. This significantly improved the stability of the transfer, and the S32 (sender) is now correctly pausing when the nRF54L15 asserts the RTS pin during flash writes.

    Current Status:

    • Hardware: nRF54L15 DK (Connected to S32K3 via UART with RTS/CTS).

    • SDK: nRF Connect SDK v3.1.0.

    • Image Size: 50,044 bytes.

    • Issue: The transfer consistently reaches approximately 48,160 bytes, at which point the nRF54L15 performs a hardware reset (I see the bootloader banner again).

    Observations & Obstacles:

    1. RRAM/Flash Label: While trying to adjust partitions to fix the 48KB crash, I encountered a CMake error: undefined node label 'flash0'

    2. The 48KB Crash: Since the crash happens right at the end of the 50KB image, I suspect a conflict between the stream_flash buffered write and the MCUboot trailer area at the end of the partition.

    3. Partition Config: I am using SB_CONFIG_BOOTLOADER_MCUBOOT=y. My current overlay defines slot0_partition and slot1_partition as 256KB (0x40000) each.

    Questions:

    • Does the nRF54L15 RRAM driver have specific alignment requirements that could trigger a system reset if the final "tail" of the image (which is not a multiple of the block size) is written?

    • Should I be using pm_static.yml instead of a devicetree overlay for the nRF54L15 to ensure the Partition Manager and MCUboot are perfectly aligned?

    I would appreciate any insight into why the device reboots specifically during the final stage of the flash_img_buffered_write process.

  • Hello,

    The program is most likely entering the error handler since you are seeing the device rebooting. The first step should be to determine which runtime error led to the error handler being invoked. To do this, make sure logging is enabled and build the project with CONFIG_RESET_ON_FATAL_ERROR=n. You should then get a crashlog when the transfer stops.

Related