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

BLE Driver Unable to write to a characteristic

Hi ,

I am unable to write to discover all services and write to a characteristic too.

On discovering services:

Discovering primary services

Received service discovery response

UUID: 0xA100, start handle: 0x000C, end handle: 0x0015

Discovering characteristics

Received characteristic discovery response, characteristics count: 3

Handle: 0x000D, UUID: 0xA101

Handle: 0x0010, UUID: 0xA102

Handle: 0x0012, UUID: 0x2A38

Discovering descriptors

Received descriptor discovery response, descriptor count: 5

Handle: 0x000D, UUID: 0x2803

Handle: 0x000E, UUID: 0xA101

Handle: 0x000F, UUID: 0x2902

Handle: 0x0010, UUID: 0x2803

Handle: 0x0011, UUID: 0xA102

it is missing a fourth service with UUID 0xA103 and I actually want to write the characteristic with UUID 0xA102. I have tried to write to the handle 0x011(15) using the code given here by Stian.

devzone.nordicsemi.com/.../

Could someone let me know where I am going wrong please? I am just not able to discover the fourth service or write to the characteristic 0xA102 with handle 0x0011

Thanks and Regards, Neil

Parents
  • You haven't discovered all the characteristics. The service discovery shows handles all the way up to 0x0015. You've only discovered up to 0x0011. You need to do another discover descriptors starting at 0x0012 until you've exhausted the service. The payload for the underlying ATT find information request is of max size MTU-2, which is 21 bytes, which is 5 {Handle,value} pairs.

  • The handle appears different as I have changed the order of the characteristics in the code.

    It appears the handle for Characteristic A102 is 0x0015 . I am still unable to write to it with the do_write function specified here devzone.nordicsemi.com/.../ .

    hrm_ctl_handle is 0x0015

    def do_write(self,value):
    
     global hrm_ctl_handle
    
        print "do_write",type(value),value,"-",hrm_ctl_handle
    
        led_value = [value]
    
        led_array = util.list_to_uint8_array(led_value)
    
        write_params = ble_driver.ble_gattc_write_params_t()
    
        write_params.handle = hrm_ctl_handle
    
        write_params.len = 1
    
        write_params.p_value = led_array.cast()
    
        write_params.write_op = ble_driver.BLE_GATT_OP_WRITE_REQ
    
        write_params.offset = 0
    

    Could you please help me?

    Thanks and Regards, Neil

Reply
  • The handle appears different as I have changed the order of the characteristics in the code.

    It appears the handle for Characteristic A102 is 0x0015 . I am still unable to write to it with the do_write function specified here devzone.nordicsemi.com/.../ .

    hrm_ctl_handle is 0x0015

    def do_write(self,value):
    
     global hrm_ctl_handle
    
        print "do_write",type(value),value,"-",hrm_ctl_handle
    
        led_value = [value]
    
        led_array = util.list_to_uint8_array(led_value)
    
        write_params = ble_driver.ble_gattc_write_params_t()
    
        write_params.handle = hrm_ctl_handle
    
        write_params.len = 1
    
        write_params.p_value = led_array.cast()
    
        write_params.write_op = ble_driver.BLE_GATT_OP_WRITE_REQ
    
        write_params.offset = 0
    

    Could you please help me?

    Thanks and Regards, Neil

Children
No Data
Related