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

Scanner is disabled after provision completes with PB-GATT enabled with 10 second delay workaround

A device that is provisioned with PB-GATT enabled stops receiving mesh packets after the provision is complete.

When the provisioning process is complete nrf_mesh_disable() is called. Later when the SD has been restarted nrf_mesh_enable() is called.

nrf_mesh_disable() will call scanner_disable() but nrf_mesh_enable() never calls scanner_enable().

This patch solves the problem.

diff --git a/mesh/core/src/nrf_mesh.c b/mesh/core/src/nrf_mesh.c
index 311225f..0c409cb 100644
--- a/mesh/core/src/nrf_mesh.c
+++ b/mesh/core/src/nrf_mesh.c
@@ -409,9 +409,13 @@ uint32_t nrf_mesh_enable(void)
             }
 #endif
             bearer_event_start();
-            /* fallthrough */
+            status = bearer_handler_start();
+            break;
         case MESH_STATE_DISABLED:
         case MESH_STATE_DISABLING:
+#if !MESH_FEATURE_LPN_ENABLED
+            scanner_enable();
+#endif
             status = bearer_handler_start();
             break;
         default:

This is a bug was introduced with the previous workaround for the 10 second delay during provision. https://devzone.nordicsemi.com/f/nordic-q-a/43992/10-second-delay-after-pb-gatt-completed-until-first-mesh-proxy-service-advertisement

Parents
  • Thanks for providing this patch! I have reported this internally. We have another workaround that also seems stable here:

    --- 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();

    And replace action_switch() in bearer_handler_timer_irq_handler() with this code:

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

    Could you try using this fix instead of the workaround mentioned by Hung Bui in the DevZone case that you mentioned?

Reply
  • Thanks for providing this patch! I have reported this internally. We have another workaround that also seems stable here:

    --- 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();

    And replace action_switch() in bearer_handler_timer_irq_handler() with this code:

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

    Could you try using this fix instead of the workaround mentioned by Hung Bui in the DevZone case that you mentioned?

Children
Related