Where is the bear handler started?

Hi support team,

Now i am trying to understand the LPN machenism based on the LPN example.  I cannot make sure where the bear handler is started. 

There is a function bearer_handler_start() which is called in nrf_mesh_enable(), but it can be called only m_mesh_state is MESH_STATE_DISABLED or MESH_STATE_DISABLING. I cannot find the clue where m_mesh_state is set to one of the two macroes before the function nrf_mesh_enable() is called after the device reset. Could you give some tips for this? 

Thanks in advance!

  • When and how is the first action in the m_action_queue (bear_handler.c) poped and performanced if there is no need to start a timeslot?  

  • Hi,

    For new projects, we highly recommend nRF Connect SDK, not the older nRF5 SDK which is now in maintenance mode. See our nRF Connect SDK and nRF5 SDK statement.

    Regarding the deep inner workings of the nRF5 SDK for Mesh stack, LPN is best understood at a higher level. For nRF5 SDK for Mesh, I recommend the Low Power node feature documentation. It also teaches the general idea behind LPN and friendship, which means it is of value also if you are going to use nRF Connect SDK.

    Regards,
    Terje

  • Hi tesc,

    We have two projects based on the nRF5 SDK for Mesh stack. Now we temporaly want to use the nRF5 SDK for Mesh stack for this project. I have read the document  you mentioned, but when I tried to understand the source code about the lpn feature, I faced the questions. 

    Actually we are trying to make a battery based switch i the mesh network (just work as a transmitter, not receive any message), so I try to understand the lpn example to get how the node can work under the low power situation.   In the real scene, it is quite possible that all friend nodes can be out of the mesh network (turn off) for over poll timeout, so the lpn node will go to high power option without the friendship. 

    How to implement this kind of switch which work under low power situation and can also send out the mesh packets to other nodes of the mesh network?  

    Is there some clue for those questions above?

    I have been stucked in here for a few days, could you give some tips or clue?  Thanks in advance!

  • Hi,

    The Low Power Node always uses the normal ADV bearer for sending messages. The Friendship and the Friend node is only required for receiving messages. It is not required for sending messages, as sending works the same for all nodes (including LPN).

    For the LPN when not in a Friendship, you can choose to operate as nomral node (using a lot of power but getting all messages sent on the network) or you can choose reduced scanning (using less power but not getting all messages sent on the network, since you spend a lot of time not scanning and there is no Friend node to relay messages.)

    In nRF Connect SDK, you enable the low power (reduced scanning) mode through the config CONFIG_BT_MESH_LPN_ESTABLISHMENT.

    Regards,
    Terje

  • Hi tesc,

    Thanks a lot. I saw a macro MESH_FEATURE_LPN_ACT_AS_REGULAR_NODE_OUT_OF_FRIENDSHIP. Setting it to 0 means that even there is no friend nodes in the netowrk, the LPN node can still work under low power consumption, is it right? 

Related