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

ble_debug_assert_handler on advertising restart

Hi everyone. I have a strange problem. As we all know, there's a bug in SDK8.0.0 that dont allows to infinite advertising. To work this around i set advertising interval to maximum value and tried to restart advertising when handling advertising timeout event. Unfortunately, everytime this event occurs, function sd_ble_gap_adv_start is called and return success, but after a moment my program gets stuck in ble_debug_assert_handler. I got annoyed by this and I commented out infinite loop in assert handler and everything appears to be working. What may be the reason of calling assert handler? I dont event know what code should I show you, as there was no difference when I was using ble_advertising_start from BLE Advertising library and when I called sd_ble_gap_adv_start with params filled by hand.

  • Well the ble_debug_assert_handler(), the default one at least, has an error code, file name and line number info, so you could use those to figure out what the assert is.

    Once the assert handler has been called then you probably don't want to return from where you came and continue, it indicates an error, so getting annoyed and commenting out the loop isn't the best idea.

    Surely the simplest solution would be to make the one line change in the advertising manager to allow infinite advertising, no restarting, no assert handling, just works.

  • Of course I didn't intended to leave this hack in release. I was just curious, what will happen. Now I'm looking for proper solution. In my assert handler, fields of file name and line number are empty. I've just got error code 0x3002 and I dont know what does it mean. I'll try to set advertising to infinite, but I'm pretty sure it won't work in my SDK version, beacause there was a bug. I reported it here in devzone and was advised to restart advertising instead. I know it was fixed in next SDK release but at this point I cant update it in my project. Thank you for your response.

  • By the way, is it possible for ble_debug_assert_handler() to be called from softdevice internals?

  • If it's the bug where you set it to zero for infinite advertising and it doesn't start at all, just remove the check for zero and it will work, I can't find your previous question, did you use a different handle? Do you have a link.

    That's the only infinite advertising bug I know about in the recent kits, and I don't think it's fixed either, it's a bug in the advertising manager.

    0x3002 makes no sense to me either. That's invalid connection handle.

  • I just realised that error handler isnt called on advertising restart, but on timeout, that is, it appears when advertising timeout comes. Removing check for zero is working, now I have infinite advertising, but this error handler is worrying however...

Related