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

BLE_ERROR_INVALID_ROLE

My devices in the field have firmware that saves an error code when it gets thrown and then sends it to a central so that I can see if there are errors with devices in the field. I got this error and I'm not sure where it came from. My device is a preipheral (S110, 8.0.0) so presumably some function is being called that is only allowed to be called by a central, but I'm not sure where I might be doing that. Any suggestions on where to look would be appreciated.

-Seth

  • Hi Seth,

    Instead of listing all the things that peripheral cannot do and trying to find out what and where your device has done one or more of those things is painstaking.

    I think we can find out the place of the error by modifying the code that catches the error and sends that error to central. At that time when an error gets thrown, you can compare it

    if(error == BLE_ERROR_INVALID_ROLE)
    { print to uart the filename and line number or loop forever }

    Then you can either see the location on the serial terminal on your PC or if you loop forever it will be easy to debug this in Keil.

  • If the headers are accurate there's only one function documented for S110 which returns that error code

    SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info));
    

    ie

    sd_ble_gap_encrypt()
    

    If you're not calling that anywhere in your code then, as Aryan suggested, you need to dump more information about where the error is coming from.

  • Seth, Please update this thread with your comments or accept the suitable answer.

Related