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.

Parents
  • 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 */

Reply
  • 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 */

Children
No Data
Related