Application won't boot when bootloader and app are using 32kHz RC oscillator. When using MPSL (BLE and IEEE802.15.4 raw) or usb_cdc.

Hi,

We're having a problem that our application will hang when using the 32 kHz RC oscillator in the mcuboot bootloader and the Zephyr application. We encountered this problem when we updated from NCS 1.5.1 to 1.8.0. 

We have looked at https://devzone.nordicsemi.com/f/nordic-q-a/81418/bug-in-ncs-v1-7-1-with-32khz-rc-oscillator-and-mcuboot-enabled and https://github.com/zephyrproject-rtos/zephyr/issues/40538 but that does not seems to fix our issue or is not included in release 1.8.0

In the supplied files is a markdown file with steps how to reproduce the problem.

What could be a temporary fix? 

What is the prospect of a permanent fix?

Best regards,

Maarten

rc_oscillator_problem_files.zip

  • Hi Maarten, 

    I was not able to reproduce the issue on a nRF52840 DK (with SB1 SB2 cut). 
    I have tested both on your blinky example with 
    west build -p -b nrf52840dk_nrf52840 -- -DDTC_OVERLAY_FILE=console.overlay && west flash

    I can see the log printed out on the USB-CDC port and the LED blinking. 

    Same applied for the usb-cdc example after adding 

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_BOOTLOADER_MCUBOOT=y

    I could see the echo worked fine. 
    I attached here the merged.hex of the blinky code that you sent. Could you please try testing on your DK ? Do you have other DK boards to test ? 
  • Hi Hung Bui,

    I've tested and verified that your 4075merged.hex is working on my devkit. I've also tested it on a second devkit which also works.

    I've tried to reproduce the binary but my sha256 hash won't match your binary. I'm using the following setups:

    Mac: 

    arm-toolchain-9-2020-q2-update

    NCS-1.8.0

    cmake version 3.21.4

    West version: v0.11.0

    Linux Ubuntu 20.04:

    Zephyr SDK 0.13.1

    NCS-1.8.0

    cmake version 3.22.0

    West version: v0.10.1

    What setup are you using and could you try to reproduce ours? 

     

    Lastly could you specify which command you used to produce the hex file you provided? 

    Thanks!

    Best regards,

    Maarten

  • Hi Maarten, 

    I used what suggested in the howtoreproduce.md file you provided: 

    west build -p -b nrf52840dk_nrf52840 -- -DDTC_OVERLAY_FILE=console.overlay && west flash

    My set up was with NCS v1.8.0 and Zephyr v2.7.0-nc1 , mcuboot v1.7.99-ncs4

    I assume you are using https://github.com/zephyrproject-rtos/sdk-ng ? 

    Have you tried to install the toolchain using our nRF Connect Toolchain manager ? 

    I might not be able to reproduce the exact setup you have. You may want to try our downstream Zephyr : https://github.com/nrfconnect/sdk-zephyr

    Also it should be possible to debug MCUBoot to check which issue caused the crash. 

  • Hi Hung Bui,

    I've some extra info,
    during debuging the debugger is stuck in: static void lfclk_spinwait(enum nrf_lfclk_start_mode mode);

    Additionally after some time the non working example seems to sync its clock and run the application when I've build them myself.
    This behaviour is very intermittent and for our product the watchdog will reset before the clocks have synced.

    I've tried to install the Nordic toolchain manager on Linux but that does not work.

    I've also tried the cut xtal traces (SB1 and SB2) with your hex which works but when I build mine and flash it the bootloader won't boot.

    As I've setup a clean environment on Linux I'm a bit out of options how to reproduce the working hex.

    Maybe if you build example 3 it will reproduce the problem on your side. (see line below)
     
    west build -p -b nrf52840dk_nrf52840\
    -- -DDTC_OVERLAY_FILE=console.overlay\
    -DOVERLAY_CONFIG=radio.conf\
    -Dmcuboot_OVERLAY_CONFIG=$(realpath mcuboot.conf)\
    -DPICOO_RADIO=ON && west flash


    Lastly I want to underscore that the issue is intermittent and a show stopper for updating at this point.

    Best regards,

    Maarten
  • Hi Maarten, 

    Could you clarify: 

    - If you run my hex file, would it work all the time ? 

    - If you build the blinky example without mcuboot, would it works with the 32kHz RC configuration ? 

    - Have you tested with other DK ? 

    My test here with the MPSL\timeslot example showed that the application hang when using: 

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0
    It doesn't hang when I remove CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0 
    It's definitely a bug with our Softdevice controller because if I use CONFIG_BT_LL_SW_SPLIT=y (Zephyr controller) then it worked. 
    But if I use 
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    It also worked fine. So it doesn't seem (at least on my setup) there is an issue with MCUBoot when using 32kHz RC without using CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0. 

    Attached is the project and the hex file that you can try.
Related