CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX questions

Hello

I've been experimenting in increasing the number of targets that a mesh FOTA distribution server can support on nRF52840

The CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX has a maximum  65535

But for practical purposes I'd be happy if I could have at least 50-60.
Ran into build asserts in zephyr\subsys\bluetooth\mesh\dfd_srv.c
"The Firmware Distribution Receivers List message does not fit into the maximum " "outgoing SDU size"

The comparison is done to the  BT_MESH_TX_SDU_MAX which is built as follows
#define BT_MESH_TX_SDU_MAX        MAX((BT_MESH_TX_SEG_MAX *     \
                       BT_MESH_APP_SEG_SDU_MAX),    \
                      BT_MESH_APP_UNSEG_SDU_MAX)
CONFIG_BT_MESH_TX_SEG_MAX is limited to 32
BT_MESH_APP_SEG_SDU_MAX is defined as 12
BT_MESH_APP_UNSEG_SDU_MAX is defined as 15
By trial and error I was able to set the number of targets to 39 with these configurations
ONFIG_BT_MESH_MSG_CACHE_SIZE=256
CONFIG_BT_MESH_ADV_BUF_COUNT=128
CONFIG_BT_MESH_TX_SEG_MAX=32
CONFIG_BT_MESH_RX_SEG_MAX=32
CONFIG_BT_MESH_TX_SEG_MSG_COUNT=64
CONFIG_BT_MESH_RX_SEG_MSG_COUNT=64
CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX=39
Is this it? Or is there another way to increase the number of supported targets?
Thank you
 
Parents
  • Hi Andy,

    What you are trying is to try sending a large number of receive info in one shot. This will exceed the maximum size of a mesh packet (segmented packets) hence the build error you saw. With mesh, the strategy is to avoid sending a large packet. It will be redistributed to the whole network and waste a lot or resources of the network (and cause congestion). 
    The better way of doing it is to send smaller number of receive list one by one using Firmware Distribution Receivers Add messages, instead of sending them at once. 

    This is my understanding after taking a look at the doc: 
    https://docs.zephyrproject.org/latest/connectivity/bluetooth/api/mesh/dfu.html#populating-the-distributor-s-receivers-list

  • The reason for the build errors is the assert. The assert occurs if CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX is increased. My goal is to be able to have 50 or more targets. If I increase the number of targets I get the assert. If I increase the CONFIG_BT_MESH_TX_SEG_MAX build succeeds but any CONFIG_BT_MESH_TX_SEG_MAX value greater than 10 results in "SDU canceled" message during transfer and transfer fails.

    So in reality  the max number of targets I can have with CONFIG_BT_MESH_TX_SEG_MAX=10 is 22

    Is there a way to overcome this limit?

    In your internal testing, what was the largest number of targets you were able to send a DFU image to?

     

  • I would need to check with the team. But what's the problem of adding the list by multiple  Firmware Distribution Receivers Add messages ? 


    Don't you agree that it's unrealistic to add 65535 addresses in one mesh message (even though the max number of receiver can be 65535 ? 

  • I don't understand your question.

    My goal is to distribute firmware to 50+ targets.

    Increasing CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX  leads to build asserts

    Increasing CONFIG_BT_MESH_TX_SEG_MAX to anything greater than 10 allows  the build to succeed but distribution fails with "SDU canceled" errors

    How can I achieve my goal? 

    Thanks 

  • Hi Andy, 

    Happy New Year ! 
    If you want to set the DFU distributor to distribute firmware to for example 60 targets, you can send 3 Firmware Distribution Receivers Add messages , each contain 20 targets. 
    The targets will be added to the list and you will have all 60 targets in the list. 

    You don't have to send one Firmware Distribution Receivers Add message with all 60 targets. 

    I believe that what the documentation suggests: 

    Before the Distributor can start distributing the firmware image, it needs a list of Target nodes to send the image to. The Initiator gets the full list of Target nodes either by querying the potential targets directly, or through some external authority. The Initiator uses this information to populate the Distributor’s receivers list with the address and relevant firmware image index of each Target node. The Initiator may send one or more Firmware Distribution Receivers Add messages to build the Distributor’s receivers list, and a Firmware Distribution Receivers Delete All message to clear it.

  • I assume by "send 3 Firmware distribution Receivers Add messages" you mean sending "mesh models dfd receivers-add" command 3 times with a different set of addresses? If that's the case - it did not work

    Here is what I did. My CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX  is set to 20


    mesh models dfd receivers-add 1,0;2,0;3,0;4,0;5,0;6,0;7,0;8,0;9,0;10,0;11,0;12,0;13,0;14,0;15,0;16,0;17,0;18,0;19,0;20,0
    mesh models dfd receivers-get 0 100
    {
    "target_cnt": 20,
    "targets": {
    "0": { "blob_addr": 1, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "1": { "blob_addr": 2, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "2": { "blob_addr": 3, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "3": { "blob_addr": 4, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "4": { "blob_addr": 5, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "5": { "blob_addr": 6, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "6": { "blob_addr": 7, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "7": { "blob_addr": 8, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "8": { "blob_addr": 9, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "9": { "blob_addr": 10, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "10": { "blob_addr": 11, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "11": { "blob_addr": 12, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "12": { "blob_addr": 13, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "13": { "blob_addr": 14, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "14": { "blob_addr": 15, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "15": { "blob_addr": 16, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "16": { "blob_addr": 17, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "17": { "blob_addr": 18, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "18": { "blob_addr": 19, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "19": { "blob_addr": 20, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 }
    }
    }

    mesh models dfd receivers-add 21,0;22,0;23,0;24,0;25,0;26,0;27,0;28,0;29,0;30,0;31,0;32,0;33,0;34,0;35,0;36,0;37,0;38,0;39,0;40,0

    mesh models dfd receivers-get 0 100
    {
    "target_cnt": 20,
    "targets": {
    "0": { "blob_addr": 1, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "1": { "blob_addr": 2, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "2": { "blob_addr": 3, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "3": { "blob_addr": 4, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "4": { "blob_addr": 5, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "5": { "blob_addr": 6, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "6": { "blob_addr": 7, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "7": { "blob_addr": 8, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "8": { "blob_addr": 9, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "9": { "blob_addr": 10, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "10": { "blob_addr": 11, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "11": { "blob_addr": 12, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "12": { "blob_addr": 13, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "13": { "blob_addr": 14, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "14": { "blob_addr": 15, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "15": { "blob_addr": 16, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "16": { "blob_addr": 17, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "17": { "blob_addr": 18, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "18": { "blob_addr": 19, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 },
    "19": { "blob_addr": 20, "phase": 0, "status": 0, "blob_status": 0, "progress": 0, "img_idx": 0 }
    }
    }

    As you can see devices with addresses 20-40 were not added

    That makes sense as CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX  is 20

    Then I don't understand what you mean by "send 3 Firmware distribution Receivers Add messages". How do I do that?
    Thanks

  • Could you try changing CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX   to 60 and send receivers-add 3 times with different sets ?

Reply Children

  • What's the difference between sending receivers-add once with 60 targets and sending it 3 times with 20 targets? All targets are added to the same list which is CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX  long. Could you clarify?
    Also if you recall I ran into another problem . CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX > 22 will require a CONFIG_BT_MESH_TX_SEG_MAX to be set to a value higher than 10 which results in "DFU canceled" error during distribution

  • I mentioned this earlier: 
    With mesh, the strategy is to avoid sending a large packet. It will be redistributed to the whole network and waste a lot or resources of the network (and cause congestion). 
    The better way of doing it is to send smaller number of receive list one by one using Firmware Distribution Receivers Add messages, instead of sending them at once. 

    Have you tried to test setting CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX >22 but only send a few target once at a time (6 targets and four times for example)? 

  • Please clarify what you mean by "send a few target once at a time"  What commands should I use??

    Do you mean I can do
    mesh models dfd receivers-add <1,2,3>

    mesh models dfd start ...

    mesh models dfd receivers-add <4,5.6>

    mesh models dfd start ...

    ??
    If that's the case - how long should I wait before sending the next batch?

  • Please try: 

    mesh models dfd receivers-add <1,2,3>

    mesh models dfd receivers-add <4,5,6>

    mesh models dfd receivers-add <7,8,9>

    mesh models dfd start ...

  • Set CONFIG_BT_MESH_DFD_SRV_TARGETS_MAX = 70

    Set CONFIG_BT_MESH_TX_SEG_MAX = 32

    Used method you suggested to add targets in batches of 3

    Get the "SDU canceled" error and transfer fails
    The error occurs regardless of the number of targets - even with just one.

    What triggers it it seems is CONFIG_BT_MESH_TX_SEG_MAX  > 10

    So at the moment I'm stuck with 22 targets - maximum possible with CONFIG_BT_MESH_TX_SEG_MAX =10 without getting build asserts.
    Please advise

Related