Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Back to back calls to ble_advertising_start(..) in nRF SDK 16.0.0 fails with INVALID_PARAMETER (i.e. 10)

I am using SDK 16.0.0.
I want to switch from a NON-CONNECTABLE, NON-SCANNABLE advertisement to a CONNECTABLE, SCANNABLE advertisement.
I launch the first advertisement and wait for it to finish after its 'DURATION' expires.
Then I launch the second advertisement (this is triggered Out of Band with a GPIOTE event).
The firmware rexecutes ALL the steps it took when it launched the first advertisement EXCEPT it uses the same configuration tag as was used in the first advertisement.

The start operation for the second advertisement fails with the error 10 i.e. INVALID PARAMETER.
The only thing I have been able to figure out is that the 'type' is different than it was before.
But the firmware DOES initialize the advertising module with the NEW type.

So, I do not understand why the Soft Device is responding with the error 10.

  • It would be greatly helpful for me to have seen the code snippet where you are stopping and reconfiguring the advertisement data directly prior to it failing. Without having seen this, it is very hard for me to pinpoint or identify the root of this issue.

    I have tried to summarize all my changes as best as I can.
    Note that the issue raised in this ticket are not specific to these changes, but the fact that upper layer calls to these modified API do not work if I call them with 'different' advertisement types at run times.
    My flow is to constantly switch the GAP layer from NC/NS to C/S back and forth with every broadcast.
    * IF I pass these changes to the modified API listed below, then I get the error indicated in this ticket.
    * IF I call these APIs with a FIXED TYPE while MAINTAINING the switching pattern at GAP LAYER then there is NO ERROR.

    Here is my set up presented in pseudo code:


    1.  BLE Advertising module's init() and start() APIs updated to take extra input:
        uint32_t ble_advertising_init(ble_advertising_t            * const p_advertising,
                                      ble_advertising_init_t const * const p_init,
        /* EXTRA */                   uint8_t                      advertising_type);
        
        uint32_t ble_advertising_start(ble_advertising_t * const p_advertising,
                                       ble_adv_mode_t            advertising_mode,
        /* EXTRA */                    uint8_t                   advertising_type);
                                     
    2.  BLE Advertising implementation sources modified at two locations:
        a)  Override the advertising module properties in function set_adv_mode_fast:
            #if !defined (S112) && !defined(S312) && !defined(S113)
            if (p_advertising->adv_modes_config.ble_adv_extended_enabled)
            {
                p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
            }
            else
            #endif // !defined (S112) && !defined(S312) && !defined(S113)
            {
                p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
            }
            /* ADDED */ p_advertising->adv_params.properties.type = advertising_type;

        b)  Set the advertising module properties in funtion ble_advertising_init as follows:
            /* ORIGINAL */   p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
            /* CHANGED TO */ p_advertising->adv_params.properties.type = advertising_type; /* input parameter */

        c)  Set the advertising module properties in funtion ble_advertising_init as follows:
            /* ORIGINAL */   p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
            /* CHANGED TO */ p_advertising->adv_params.properties.type = advertising_type; /* input parameter */

  • Hi Karl,


    My design has gone through a few changes these past few days and I no longer am able to reproduce this failure.
    I suspect this may have been a bug that I luckily resolved in making other changes.
    But I still need to add the extra parameter to the Bluetooth advertising modules to handle my requirements.

    Apologize for wasting your time on this matter.
    Please feel free to close this ticket.

    Cheers
    RMV

  • Hello RMV,

    RMV said:
    My design has gone through a few changes these past few days and I no longer am able to reproduce this failure.
    I suspect this may have been a bug that I luckily resolved in making other changes.

    I am happy to hear that you are no longer seeing this issue.
    The issue you described and error code that was generated definitely sounds like something that could be fixed along the way while you are still developing your code. As the error code mentions, I suspect that you tried to pass an invalid parameter to a SoftDevice function somewhere.

    I understood the general execution of your program from your first description - it was a good description.

    RMV said:
    But I still need to add the extra parameter to the Bluetooth advertising modules to handle my requirements.

    Yes, this is correct - as mentioned in my previous reply, the BLE advertising module is made to facilitate connectable advertising (like mentioned in its documentation). However, I think the modification you have made to the module seems alright for the purpose - I do not immediately see any reason why this should not work.

    RMV said:
    Apologize for wasting your time on this matter.
    Please feel free to close this ticket.

    No worries, I am happy to help! :)

    Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Related