Advertising failed to start (err -120)

I am running into an issue (title), where I am attempting to switch the advertising interval to a slower interval after a set period of advertising in order to save power. Advertising is being successfully started the first time, I then start a timer. In the timer expiration handler, I call bt_le_adv_stop(), and then initialize advertising again, this time with a different set of min and max intervals. The second time around, bt_le_adv_start() returns -120 (EALREADY). I have tried adding a delay in between the stop and start functions in case it takes longer than expected for advertising to stop, but this did not change the outcome. Also, bt_le_adv_stop() is returning 0 which I believes implies the action was successful. Any help would be appreciated, thanks!

I am using:
NCS v2.6
nRF52832

  • Attached below is a zip of the ble lbs example with my ported problematic code. A fault still occurs at a similar spot as with my custom project, but the error is different in this case.
    The print output looks as follows:

    Advertising Started
    slow_adv_timer EXPIRED
    ASSERTION FAIL @ WEST_TOPDIR/zephyr/kernel/sem.c:136
    E: r0/a1: 0x00000004 r1/a2: 0x00000088 r2/a3: 0x00000001
    E: r3/a4: 0x0001be65 r12/ip: 0x00000000 r14/lr: 0x000202f7
    E: xpsr: 0x61000021
    E: Faulting instruction address (r15/pc): 0x00023a7c
    E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    E: Fault during interrupt handling

    E: Current thread: 0x20002558 (unknown)

    This time, instruction address 0x000023a7c correlates to assert_post_action() as opposed to sys_dlist_remove() from my custom project. 


    ble_adv_bug_test.zip

  • Hi, do you have any updates on your end? I have been trying to debug on my end over the last week and still have not made any progress. 

Related