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

Difference in characteristics display between nRF Connect App on PC and App on MOBILE

Hi,

I am developing a sensor application with the nRF52832 on a custom board.

Therefore I designed a GATT with nRF5_SDK_14.0.0 softdevice which exposes 3 custom characteristics with their associated Characteristic User Descriptors. This all looks OK when connecting with the nRF Connect App on the PC, shown in the following picture:

But when I try to display these characteristics on my MOBILE nRF Connect APP, I get the following "strange" display (I added red markers on the screen-shot):

[1] Why does the APP show "Unknown Characteristic" where it should display my Characteristic User Descriptor?
[2] Why ist there such a strange (long) value shown on the second characteristic? This characteristic should read only 4 bytes (see screenshot of nRF Connect on PC).
[3] Same here?

I already reinstalled the nRF Connect APP on my MOBILE, but still the same... How can I get the same data on my PC APP and on my MOBILE APP with nRF Connect?

Thanks for your support.

With kind regards, Stefan

Parents
  • Hi,

    1. The characteristics name is gathered from comparing the UUID towards know UUIDs. If your UUID is not found in this list, it will show Unknown Characteristics.
    2. It seems that notifications have been enabled on desktop side. Have you pressed the read button or tried enabling notifications (by pressing three arrows button) in mobile as well? It could be some garbage data if the characteristics is not properly initialized. Note that the max/init length can be larger than the "normal length" that you send in notifications. Can you post the initialization code for this characteristics?
    3. See point 2.

    Best regards,
    Jørgen

Reply
  • Hi,

    1. The characteristics name is gathered from comparing the UUID towards know UUIDs. If your UUID is not found in this list, it will show Unknown Characteristics.
    2. It seems that notifications have been enabled on desktop side. Have you pressed the read button or tried enabling notifications (by pressing three arrows button) in mobile as well? It could be some garbage data if the characteristics is not properly initialized. Note that the max/init length can be larger than the "normal length" that you send in notifications. Can you post the initialization code for this characteristics?
    3. See point 2.

    Best regards,
    Jørgen

Children
  • Hi Jorgen, and thanks for your help.

    1. Ok, sounds reasonable.

    2. I pressed the read button and enabled notifications, but this does not change anything. Below I send you the init code for my second characteristic. Thanks for checking...

    /**@brief Function for adding the Sensor Value Characteristic.
     *
     * @param[in] p_doss      DOSS Service structure.
     * @param[in] p_doss_init DOSS Service initialization structure.
     *
     * @retval NRF_SUCCESS on success, else an error value from the SoftDevice
     */
    static uint32_t sensor_value_char_add(ble_doss_t * p_doss, const ble_doss_init_t * p_doss_init)
    {
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_md_t cccd_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;
    
        memset(&cccd_md, 0, sizeof(cccd_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
        cccd_md.vloc = BLE_GATTS_VLOC_STACK;
    
        memset(&char_md, 0, sizeof(char_md));
    
        char_md.char_props.read   = 1;
        char_md.char_props.notify = 1;
        
        // char_md.p_char_user_desc  = "NULL";
        
        static char user_desc[] = "Sensor Value";
        char_md.p_char_user_desc  = (uint8_t *) user_desc;
        char_md.char_user_desc_size = strlen(user_desc);
        char_md.char_user_desc_max_size = strlen(user_desc);	
        
        
        char_md.p_char_pf         = NULL;
        char_md.p_user_desc_md    = NULL;
        char_md.p_cccd_md         = &cccd_md;
        char_md.p_sccd_md         = NULL;
    
        ble_uuid.type = p_doss->uuid_type;
        ble_uuid.uuid = DOSS_UUID_SENSOR_VALUE;
    
        memset(&attr_md, 0, sizeof(attr_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
        attr_md.vloc    = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth = 0;
        attr_md.wr_auth = 0;
        attr_md.vlen    = 0;
    
        memset(&attr_char_value, 0, sizeof(attr_char_value));
    
        attr_char_value.p_uuid    = &ble_uuid;
        attr_char_value.p_attr_md = &attr_md;
        attr_char_value.init_len  = sizeof(uint8_t); // already tried 4, but nRF Connect APP still display garbage 
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = 4;               // sensor value size is 4 bytes
        attr_char_value.p_value   = NULL;
    
        return sd_ble_gatts_characteristic_add(p_doss->service_handle,
                                               &char_md,
                                               &attr_char_value,
                                               &p_doss->sensor_value_char_handles);
    }

  • Have you tried setting attr_char_value.p_value to something else than NULL?

  • Yes, I did the following, without success:

       
    [...]
    static uint8_t value[] = "1234";
    attr_char_value.p_value   = value;           // was NULL before
    [...]
       

  • If you can upload your entire project, I can debug it and see if I can figure out why this is happening.

  • I don't know how to upload to devzone, so here is an external link for downloading my project:  https://drive.google.com/file/d/1_p5jeaIHz33PLexP4xDLm0mKe_gONNPr/view?usp=sharing

    Please note that  this is an IAR project and must follow a special folder structure for the relative SDK path:

    .\nrf52_3100-1_fw
    .\nrf5_sdk\nRF5_SDK_14.2.0_17b948a

    Although it's for a custom board, it should run fine on the nRF52 DK (with internal RC LFCLK).

Related