nRF SDK for Mesh serial example - Unable to delete appkey

Hi,

This is a project using nrf5 SDK for Mesh v5.0.0. We are using a machine to machine interface with the serial example. I am seeing this issue here:

Sending appkey_get_all request...
TX Data Buf: 03 9a 00 00
RX Length: 7
RX Data Buf: 84 9a 00 00 00 03 00
Opcode 9a => ble_mesh_appkey_get_all_req; Status: 0x00=> Success; Data: 00 00 03 00
Subnet handle: 0x0000; Appkey Indexes: 0x0003
Sending appkey delete request...
TX Data Buf: 03 99 03 00
RX Length: 4
RX Data Buf: 84 99 8e
Opcode 99 => ble_mesh_appkey_delete_req; Status: 0x8e=> ERROR_REJECTED

In summary:

We can see that appkey handle 3 is bound to netkey handle 0 in the serial example. When we try to delete appkey handle 3 on that subnet, we get the status SERIAL_ERROR_REJECTED. When we run appkey_get_all for that subnet once again, appkey 3 is still there.

In the device state manager, this handles the deletion:

uint32_t dsm_appkey_delete(dsm_handle_t app_handle)
{
    if (app_handle >= DSM_APP_MAX || !bitfield_get(m_appkey_allocated, app_handle))
    {
        return NRF_ERROR_NOT_FOUND;
    }
    else
    {
        dsm_entry_invalidate(MESH_OPT_DSM_APPKEYS_RECORD, app_handle, m_appkey_allocated);
        return NRF_SUCCESS;
    }
}

Where DSM_APP_MAX = 8 and the size of m_appkey_allocated is 1. I can't see a reason why the program thinks the appkey handle is invalid when it returns the same handle when we query it. Any ideas?

Parents
  • Hello,

    There are a lot of people out of office this week, so you may need to wait until next week before someone can take a look.

    Kenneth

  • Hi again,

    Sorry, I asked around, but no one had an idea what could be causing this. For new designs you should be using nRF Connect SDK.

    Keneth

  • Thanks for getting back to me Kenneth.

    Unfortunately, a conversion to the nRF Connect SDK would be a big undertaking at this moment in time. A lot of the machine-to-machine code handling the commands would have to be rewritten. 

    Correct me if I'm wrong, but the only way to create a BLE Mesh gateway using the NCS is to use the mesh_shell "application" in the zephyr/tests/bluetooth folder? I did decide to explore it but documentation seems to be scarce on the NCS and Zephyr SDK. It's also not an application sample so you have to forgive me if I don't believe that it is fit for production/evaluation purposes.

    The current nRF5 SDK for Mesh implementation is stable for my gateways in production. I will gladly move to the NCS once it has a mature serial gateway implementation.

    Regards,

    Arif

  • Hi,

    The general maturity level of Bluetooth mesh in nRF Connect SDK is better than that of the nRF5 SDK for Mesh.

    Regarding the mesh_shell project in the zephyr/tests/bluetooth/ folder, you are correct it is not a sample nor an application example. Rather, it exposes all mesh functionality through a shell interface. It is used for testing new and existing features of the mesh stack, models, etc. Since it is part of the test framework I would expect sparser documentation than for official samples, yes. Since it is a shell (typically designed for interactive use by a human), I would also expect the set of commands, format of output, etc. to change more often. For machine to machine communication, basing it off of a clear cut specification would be better.

    Depending on what needs you have for your gateway, the Bluetooth: Mesh Provisioner sample may be a suitable sample to reference for the mesh side of things. If you need a serial communications protocol between the nRF device and a connected companion MCU, then your options for suitable samples or development starting points may be limited.

    Please note that nRF5 SDK, including nRF5 SDK for Mesh, is now in maintenance mode and not recommended for new projects. It has been in this state for a few years already. See our nRF Connect SDK and nRF5 SDK statement (originally posted in 2021 and last updated earier this year) for details. While we do our best to still help out with the (older) nRF5 SDK, in practice we are unfortunately unable to provide the same level of support that we have for the (newer) nRF Connect SDK.

    Regarding the original issue of this thread, have you been able to locate where the SERIAL_ERROR_REJECTED error comes from, or had any other progress towards solving the issue?

    Regards,
    Terje

    Regards,
    Terje

Reply
  • Hi,

    The general maturity level of Bluetooth mesh in nRF Connect SDK is better than that of the nRF5 SDK for Mesh.

    Regarding the mesh_shell project in the zephyr/tests/bluetooth/ folder, you are correct it is not a sample nor an application example. Rather, it exposes all mesh functionality through a shell interface. It is used for testing new and existing features of the mesh stack, models, etc. Since it is part of the test framework I would expect sparser documentation than for official samples, yes. Since it is a shell (typically designed for interactive use by a human), I would also expect the set of commands, format of output, etc. to change more often. For machine to machine communication, basing it off of a clear cut specification would be better.

    Depending on what needs you have for your gateway, the Bluetooth: Mesh Provisioner sample may be a suitable sample to reference for the mesh side of things. If you need a serial communications protocol between the nRF device and a connected companion MCU, then your options for suitable samples or development starting points may be limited.

    Please note that nRF5 SDK, including nRF5 SDK for Mesh, is now in maintenance mode and not recommended for new projects. It has been in this state for a few years already. See our nRF Connect SDK and nRF5 SDK statement (originally posted in 2021 and last updated earier this year) for details. While we do our best to still help out with the (older) nRF5 SDK, in practice we are unfortunately unable to provide the same level of support that we have for the (newer) nRF Connect SDK.

    Regarding the original issue of this thread, have you been able to locate where the SERIAL_ERROR_REJECTED error comes from, or had any other progress towards solving the issue?

    Regards,
    Terje

    Regards,
    Terje

Children
  • Thanks for your detailed answer Terje,

    Unfortunately, I do need a serial communications protocol between the nRF device and a connected companion MCU for my gateway to work. That's currently how it operates with the nRF5 SDK for Mesh's serial example, modified for my purposes. I am aware that the SDK is in maintenance mode. 

    According to my local FAE, the best option is to use the mesh_shell application. It's in the zephyr folder so is the best place to ask for technical support the DevZone or Zephyr forums?

    Regarding the original issue, no I have no solution except to do a Bluetooth Mesh State Clear command and hope it doesn't happen again.

    Regards,

    Arif

  • Hi,

    Arif@Lynxemi said:
    It's in the zephyr folder so is the best place to ask for technical support the DevZone or Zephyr forums?

    We do support the full SDK delivery here on DevZone, including components coming from the Zephyr project. In some instances we might refer you to the Zephyr community for support, for most things nRF related we can handle it here.

    Arif@Lynxemi said:
    Regarding the original issue, no I have no solution except to do a Bluetooth Mesh State Clear command and hope it doesn't happen again.

    Thanks for sharing the workaround. I don't think we'll delve any deeper into the nRF5 SDK for Mesh, I'm afraid, so I do hope this happens seldom enough for that to be an acceptable solution.

    Regards,
    Terje

Related