cancel
Showing results for 
Search instead for 
Did you mean: 

Read Characteristic attribute issue

oga
Associate III

I'm trying to achieve a simple characteristic read from a client device on a STM32WB55 to a server device on a STM32WB35

on client side 

- after connecting I get a HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE and I keep track of connection_handle in a grobal struct and immediatly calling aci_gatt_disc_all_primary_services()

- when receiving ACI_ATT_READ_BY_GROUP_TYPE_RESP_VSEVT_CODE I'm keeping track of my services handles(start and end)  in my global struct and out of event handle I'm requesting aci_gatt_disc_all_char_of_service() of the service I'm intrested in

- when receiving ACI_ATT_READ_BY_TYPE_RESP_VSEVT_CODE I'm recording the attribute carac handle in mùy global struct and out of event handler I'm calling aci_gatt_read_char_value(ClientContext.connHandle, ClientContext.CaracHandle);

the return value is OK and I was hopping for a ACI_ATT_READ_RESP_VSEVT_CODE to pop in my event handler but I get none I'm just receiving a ACI_GATT_ERROR_RESP_VSEVT_CODE with parameters

Connection_Handle 0x0801
Attribute_Handle 0x140A
Error_Code 0x01
Req_Opcode 0x0C

followed by a ACI_GATT_PROC_COMPLETE_VSEVT_CODE

as in https://www.st.com/content/ccc/resource/technical/document/user_manual/6d/a1/5b/6c/dc/ab/48/76/DM00162667.pdf/files/DM00162667.pdf/jcr:content/translations/en.DM00162667.pdf

I don't found in what document I've read that getting ACI_GATT_ERROR_RESP_VSEVT_CODE is part of process and in the fact I'm receiving it also in precedent discovering steps just before the closing ACI_GATT_PROC_COMPLETE_VSEVT_CODE

here you can find a debug log of different events

SVCCTL_App_Notification >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GAP_PROC_COMPLETE_VSEVT_CODE
SVCCTL_App_Notification >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GAP_PROC_COMPLETE_VSEVT_CODE
SVCCTL_App_Notification >>> HCI_LE_META_EVT_CODE
>>> HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE

[custom_app_ble.c][Update_Service][1243] DISCOVER PRIME SERVICES HANDLE
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_ATT_READ_BY_GROUP_TYPE_RESP_VSEVT_CODE
0 SERVICE FOUND
- connection handle 0x00-0x0801
- MAC ***********
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_ATT_READ_BY_GROUP_TYPE_RESP_VSEVT_CODE
1 SERVICE FOUND
- connection handle 0x00-0x0801
- MAC ************
- UUID ****
- ServiceStartHandle 0x000C
- ServiceEndHandle 0x000F

Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_ATT_READ_BY_GROUP_TYPE_RESP_VSEVT_CODE
2 SERVICE FOUND
- connection handle 0x00-0x0801
- MAC ***************
- UUID ****
- ServiceStartHandle 0x0012
- ServiceEndHandle 0x0015

Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_ERROR_RESP_VSEVT_CODE
Connection_Handle 0x0801
Attribute_Handle 0x0013
Error_Code 0x0A
Req_Opcode 0x10
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_PROC_COMPLETE_VSEVT_CODE

[custom_app_ble.c][Update_Service][1249] DISCOVER 2ND SERVICE CARAC HANDLE
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_ATT_READ_BY_TYPE_RESP_VSEVT_CODE

[custom_app_ble.c][Event_Handler][803] -- GATT : UUID 06201 FOUND CARAC HND 0x0014- connection carac_handle 0x801
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_ERROR_RESP_VSEVT_CODE
Connection_Handle 0x0801
Attribute_Handle 0x0014
Error_Code 0x0A
Req_Opcode 0x08
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_PROC_COMPLETE_VSEVT_CODE

[custom_app_ble.c][Update_Service][1263] READING CARAC
SUCCESS
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_ERROR_RESP_VSEVT_CODE
Connection_Handle 0x0801
Attribute_Handle 0x140A
Error_Code 0x01
Req_Opcode 0x0C
Event_Handler >>> HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>> ACI_GATT_PROC_COMPLETE_VSEVT_CODE

when trying to read same characteristic with a phone test app, on server side I get the desired ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE and everything look ok

 as you can see on this debug log from server side :

Adv_Request:1215 >==>> aci_gap_set_discoverable - Success
SVCCTL_App_Notification >>>HCI_LE_META_EVT_CODE
>>>HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
>>== HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
- Connection Interval: 7.50 ms
- Connection latency: 0
- Supervision Timeout: 5000 ms
SVCCTL_App_Notification >>>HCI_LE_META_EVT_CODE
>>>HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
>>== HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
- Connection Interval: 48.75 ms
- Connection latency: 0
- Supervision Timeout: 5000 ms
SVCCTL_App_Notification >>>HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE
>>>ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE
SVCCTL_App_Notification >>>HCI_DISCONNECTION_COMPLETE_EVT_CODE

but when reading from my own client app get no event server side at all.

I'm pretty sure I missed something but I can't put my finger on I've look all examples as "P2P" or "heart-rate" but they all using Notifications and that's not what I want right now (may be later but not for this attribute) I've also found different topic here with people struggling with reading but none of them with my problems

any help would be more than appreciated

PS : and for record I've also try aci_gatt_read_using_char_uuid() and aci_gatt_read_char_long_value() with no success

 

1 ACCEPTED SOLUTION

Accepted Solutions
oga
Associate III

I found the issue nothing related to the process just an error during catch of carac handle

View solution in original post

1 REPLY 1
oga
Associate III

I found the issue nothing related to the process just an error during catch of carac handle