2

I am using an STM32L4 chip that sends an update to the nRF52832 on a ublox module over USART. I assume the nordic chip is in the bootloader during the update.

We get a UART error: 4 and when we observe the UART lines we see that on the TX line of the nRF the stop bit is not present. I assume the nRF does not pull the line high properly after transmitting a frame. (we do not use pull-up resistors on the USART lines on STM32L4 side) When trying to update with an OTA the device updates but then falls back into the bootloader at startup making me assume the problem is with the bootloader.

I am wondering if there is such documented cases of bootloader errors or if the missing stop bit could point to another issue with my HW/SW?

Thank you for any hint!

Bad behavior with missing stop bit: enter image description here Good behavior with stop bit present: enter image description here Bad behavior with • blue: CTS • red: RTS • green: UART RX • yellow: UART TX enter image description here

  • First of all, if you want some meaningful answer show where the UART goes from idle to sending for the first time, or it's impossible to tell where the frames start and end. It could as well be your scope not synching properly for all I can tell. Second, you should always place a pull-up on the UART rx line and not rely on some other module always being present to do that. – Lundin May 04 '22 at 14:05

1 Answers1

1

The problem was the clock setting (low accuracy clock was used probably)

solution is here: https://devzone.nordicsemi.com/f/nordic-q-a/87580/issue-with-updating-nrf52832-over-usart

    err_code = sd_clock_hfclk_request();
APP_ERROR_CHECK(err_code);

uint32_t hfclk_is_running = 0;

while (!hfclk_is_running)
{
    APP_ERROR_CHECK(sd_clock_hfclk_is_running(&hfclk_is_running) );
}

It must be called here:

ret_code_t nrf_bootloader_init(nrf_dfu_observer_t observer)

{ NRF_LOG_DEBUG("In nrf_bootloader_init");

.....

    // SoftDevice is started
    ret_val = nrf_dfu_init(dfu_observer);
    if (ret_val != NRF_SUCCESS)
    {
        return NRF_ERROR_INTERNAL;
    }


    /*
     *  ATTENTION: sd_clock_hfclk_request required the SoftDevice to be running/available
     *  Therefore it must be called after nrf_dfu_init (which calls nrf_dfu_transports_init which inits the SD and UART)
     *  In a bootloader/app without OTA and therefore no SD we must use nrf_drv_clock_hfclk_request
     */
    // Request the external high frequency crystal for best UART clock accuracy. For lowest current consumption, don't request the crystal.
    sd_clock_hfclk_request();
    uint32_t p_is_running = 0;
    while(! p_is_running) {          //wait for the hfclk to be available
        sd_clock_hfclk_is_running((&p_is_running));
    }