This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF5 SDK for Mesh v0.10.1DFU Hangs?

Hello,

I am working with the nRF-SDK-for-Mesh v0.10.1 I am able to compile and run everything fine. However the DFU example hangs. It looks like a hard fault ( all the LEDs are on).

I am following the guide from the SDK docs here:

infocenter.nordicsemi.com/.../md_doc_getting_started_dfu_quick_start.html

I am using:

PCA10031, nrf51422, s130

SoftDevice: /external/softdevice/s130_2.0.1/s130_nrf51_2.0.1_softdevice.hex

Bootloader: /bin/bootloader_serial_xxAC.hex

DFU: /build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex

When running the DFU example It hangs during mesh stack initialization in "nrf_mesh_int()" from "nrf_mesh.c" around line 145 I believe in the "core_tx_init()" function. I have tried the serial example which has similar init code and it works fine (except it doesn't except DFU commands because for some reason it is linking the "_weak" functions in "nerf_mesh_weak.c" instead of the real ones (I am posting this in another question).

Here is the RTT Trace:

<t:        265>, main.c,  162, ----- Bluetooth Mesh DFU Example -----
<t:        281>, nrf_mesh_sdk.c,  181, Initializing softdevice
<t:          4>, nrf_mesh_sdk.c,  122, Initializing SoftDevice...
<t:         18>, nrf_mesh_sdk.c,  131, Ram base: 0x200022D8
<t:         84>, nrf_mesh_sdk.c,  140, sd_ble_enable: app_ram_base should be adjusted to 0x20001900
<t:        110>, nrf_mesh_sdk.c,  191, Initializing mesh stack

Thank you!

Here is the stack trace:

Temporary breakpoint 1, main () at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/examples/dfu/src/main.c:153
153	{
(gdb) continue
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
sleep_forever (pc=pc@entry=1) at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/examples/nrf_mesh_sdk.c:64
64	    while (pc)
(gdb) backtrace
#0  sleep_forever (pc=pc@entry=1) at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/examples/nrf_mesh_sdk.c:64
#1  0x0001b88e in HardFault_Handler () at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/examples/nrf_mesh_sdk.c:85
#2  <signal handler called>
#3  0x00026c74 in timer_on_ts_begin (timeslot_start_time=0) at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/mesh/core/src/timer.c:304
#4  0x00026f92 in on_ts_begin (p_timeslot=0x200038e0 <m_current_timeslot>) at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/mesh/core/src/timeslot.c:180
#5  0x0002706c in handle_extend_end (p_timeslot=p_timeslot@entry=0x200038e0 <m_current_timeslot>, success=success@entry=true)
    at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/mesh/core/src/timeslot.c:317
#6  0x000270fa in radio_signal_callback (sig=<optimized out>) at /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/mesh/core/src/timeslot.c:396
#7  0x0001a2b0 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  • Hi Jason,

    Have you double checked that it's crashed ? I believe the log will be like that if you don't start any DFU command from the PC.

  • Yeah, pretty sure it was hanging so I just added the GBD stack trace see above.

  • Hi Jason,

    Step through the code after a break point wouldn't work all the time. The reason is the Mesh stack uses the timeslot function on the softdevice. And the softdevice has some strict requirement on the timer . It crashes when you stop for a breakpoint. And most of the time you will end up in a hardfault if you step through a softdevice SVC call.

    But from your log and what you have seen on the board, seems that there is an issue. The log should be something like this:

     0> <t:        292>, main.c,  162, ----- Bluetooth Mesh DFU Example -----
     0> <t:        308>, nrf_mesh_sdk.c,  181, Initializing softdevice
     0> <t:          0>, nrf_mesh_sdk.c,  122, Initializing SoftDevice...
     0> <t:         14>, nrf_mesh_sdk.c,  131, Ram base: 0x200022D8
     0> <t:         84>, nrf_mesh_sdk.c,  140, sd_ble_enable: app_ram_base should be adjusted to 0x20001900
     0> <t:        115>, nrf_mesh_sdk.c,  191, Initializing mesh stack
     0> <t:       1872>, nrf_mesh_dfu.c,  528, 	RADIO TX! SLOT 0, count 255, interval: periodic, handle: FFFE
     0> <t:       1902>, nrf_mesh_dfu.c,  561, 	SERIAL TX!
     0> <t:       1921>, nrf_mesh_sdk.c,  198, Enabling mesh stack
     0> <t:       1944>, serial_handler_prov.c,  212, Generating encryption keypair...
     0> <t:      39222>, main.c,  186, Enabling serial interface...
     0> <t:      39242>, main.c,  190, Initialization complete!
    

    And the red LED should be on.

    It's strange that it didn't throw any assertion in your case.

    I attached here the hex file I used and it worked for me. Could you please check ? Make sure you trigger a reset using nrfjprog after you program. Many times I found SES make the chip hang after programming.

    dfu_nrf51422_xxAC_s130_2.0.1.hex

  • Yes, that worked. I upgraded my compiler to gcc-arm-none-eabi-6-2017-q2-update and now it seems to be running, however when I try a DFU it aborts:

    RTT Log:

    <t:        325>, main.c,  162, ----- Bluetooth Mesh DFU Example -----
    <t:        345>, nrf_mesh_sdk.c,  181, Initializing softdevice
    <t:          5>, nrf_mesh_sdk.c,  122, Initializing SoftDevice...
    <t:         23>, nrf_mesh_sdk.c,  131, Ram base: 0x200022D8
    <t:         92>, nrf_mesh_sdk.c,  140, sd_ble_enable: app_ram_base should be adjusted to 0x20001900
    <t:        123>, nrf_mesh_sdk.c,  191, Initializing mesh stack
    <t:       1316>, nrf_mesh_dfu.c,  528, 	RADIO TX! SLOT 0, count 255, interval: periodic, handle: FFFE
    <t:       1348>, nrf_mesh_dfu.c,  561, 	SERIAL TX!
    <t:       1371>, nrf_mesh_sdk.c,  198, Enabling mesh stack
    <t:       1397>, serial_handler_prov.c,  212, Generating encryption keypair...
    <t:      38419>, main.c,  186, Enabling serial interface...
    <t:      38441>, main.c,  190, Initialization complete!
    <t:     261902>, nrf_mesh_dfu.c,  390, 	New firmware!
    <t:     261927>, nrf_mesh_dfu.c,  528, 	RADIO TX! SLOT 0, count 255, interval: periodic, handle: FFFD
    <t:     261960>, nrf_mesh_dfu.c,  534, Killing a TX slot prematurely (repeats done: 0).
    <t:     261986>, nrf_mesh_dfu.c,  561, 	SERIAL TX!
    <t:     328229>, nrf_mesh_dfu.c,  528, 	RADIO TX! SLOT 0, count 255, interval: periodic, handle: FFFD
    <t:     328262>, nrf_mesh_dfu.c,  534, Killing a TX slot prematurely (repeats done: 0).
    <t:     328288>, nrf_mesh_dfu.c,  561, 	SERIAL TX!
    <t:     394303>, nrf_mesh_dfu.c,  383, 	Abort event. Reason: 0xC
    <t:     394328>, nrf_mesh_dfu.c,  528, 	RADIO TX! SLOT 0, count 255, interval: periodic, handle: FFFE
    <t:     394361>, nrf_mesh_dfu.c,  534, Killing a TX slot prematurely (repeats done: 20).
    <t:     394388>, nrf_mesh_dfu.c,  561, 	SERIAL TX!
    

    nrfutil log:

    nrfutil --verbose dfu serial -pkg ../build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex.zip -p /dev/tty.usbmodem1441 -b 115200 -fc --mesh
    Upgrading target on /dev/tty.usbmodem1441 with DFU package /Users/jasonpeterson/Documents/nrf5_SDK_for_Mesh_v0-2a/build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 93584
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    PC -> target: 0502aabbccdd
    target -> PC: 0582aabbccdd
    Got echo response
    Sending DFU init packet
    PC -> target: 1378fdff040fe064a2a659000000010002000000
    target -> PC: 16a6045900000001000200000059000000010001000000
    target -> PC: 03847800
    PC -> target: 1378fdff040fe064a2a659000000010002000000
    target -> PC: 03847800
    PC -> target: 1478fcff0000e064a2a6ffffffff645b000000000c
    target -> PC: 0ea30104590000000100020000000c
    target -> PC: 03847800
    Sending firmware file
      [------------------------------------]    1%  0d 00:11:52PC -> target: 1978fcff0100e064a2a6007d0020614b0200a14b0200f1b70100
    target -> PC: 03847887
    PC -> target: 1978fcff0100e064a2a6007d0020614b0200a14b0200f1b70100
    target -> PC: 03847887
    

    boot loader_verify:

    python ../tools/dfu/bootloader_verify.py 680329450 /dev/tty.usbmodem1441 
    Device family:			NRF51
    Reading UICR..			OK.
    Reading Device page..		OK.
    Resetting device..		OK (In application)
    Checking serial connection..	OK.
    
    Bootloader verification OK.
    

    here is how I am generating the dfu file:

    nrfutil dfu genpkg --application ../build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex --company-id 0x00000059 --application-id 1 --application-version 2 --sd-req 0x0087 --mesh ../build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex.zip
    Zip created at ../build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex.zip
    
  • When I use the "examples/dfu/bin/app_green_s130.hex" file to generate the DFU package and upload it It works!

    However, when I use "/build/examples/dfu/dfu_nrf51422_xxAC_s130_2.0.1.hex" I get the error in my previous comment...?

Related