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

10 second delay after PB-GATT completed until first Mesh Proxy Service advertisement

Hi,

After provisioning a device using PB-GATT there is a 10 second delay after the PB-GATT connection is closed and the first Mesh Proxy Service advertisement is sent.

When the PB-GATT connection is closed the stack will end up in sd_state_evt_handler in mesh_provisionee.c after both the mesh stack and softdevice has been disabled.

The code will go on and call proxy_node_id_enable() -> adv_start() -> mesh_adv_start() -> sd_ble_gap_adv_start() and timeslot_restart().

I suspect that the issue is with timeslot_restart() as it's configured to request maximum 10 second timeslots by default (TIMESLOT_MAX_LENGTH_US). If this value is changed to 7 seconds I see a 7 second delay instead.

This issue can be seen by provisioning a device with light_switch_server_nrf52832_xxAA_s132_6.1.0_merged.hex from SDK for Mesh v3.1.0 using the nRF Mesh iOS app.

Attach is a pcap file that shows this behavior. Compare the time between packet 155 and 156, there is a delay of 10 seconds.

From the Mesh Profile v1.0.1, section 7.2.2.2.3 "Advertising with Node Identity"

"If PB-GATT is supported and Mesh Proxy Service is exposed, immediately after provisioning is completed
using PB-GATT (see Section 5.2.2), the Mesh Proxy Service shall start advertising with Node Identity
using the provisioned network."

provision_light_switch_server.pcapng

Thanks.

  • It seems this workaround was slightly unstable, as figured out internally & thanks to  in this case! We have a new workaround. In the bearer_handler.c file found under mesh/bearer/src/bearer_handler.c, you can make these changes inside the bearer_handler_stop() function:

    --- a/mesh/bearer/src/bearer_handler.c
    +++ b/mesh/bearer/src/bearer_handler.c
    @@ -319,10 +319,14 @@ uint32_t bearer_handler_stop(bearer_handler_stopped_cb_t cb)
             /* Will stop the timeslot when the current action ends. */
             m_stopped_callback = cb;
             m_stopped = true;
    -        if (timeslot_session_is_active())
    +        if (timeslot_is_in_ts())
             {
                 timeslot_trigger();
             }
    +        else if (timeslot_session_is_active())
    +        {
    +            timeslot_stop();
    +        }
             else
             {
                 notify_stop();

    Update: As can be seen in this case, one should also replace action_switch() in bearer_handler_timer_irq_handler() with this code:

     if (m_stopped)
            {
                timeslot_stop();
            }
            else
            {
                action_switch();
            }

    This ensures that the 10 second delay works in both PB-ADV & PB-GATT. Without this extra code, the 10 second delay is still present in PB-ADV.

Related