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

Parents Reply Children
  • Hello,

    I am strugglnig a bit with the custom board setup. Is it possible to send an application that I can build for the board nrf52dk_nrf52832? If it complains a lot about peripherals and gpios, it should be possible to either add it to the nrf52dk_nrf52832.overlay, or you can just exclude those parts from the application. It shouldn't matter much for the BLE part of the application.

    Alternatively, just take the BLE part of your application and add it to any of the BLE samples in NCS.

    BR,

    Edvin

  • What part of the custom board setup isn't working for you? The project was developed with an nRF52dk using the custom board files as the only difference between the custom hardware and the DK are the button and LED pins which should not be relevant for this bug. 


    I can work on putting the problem portion of the code into one of the examples and make sure the issue is replicable before sending it over.

  • 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