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

Service Discovery - ATT Read Transaction 0; Invalid Handle

Hi Nordic,

I am working on a project where I connect via nrf52 DK, to a peripheral. I am runinng on SDK15, with the experimental build ble_app_interactive, inside the ble_central_and_peripheral folder. I have made some minor changes to the program, but these should not effect it in any way.

Now to the problem. When connecting to the peripheral, there is no problem. I am running with privacy on, since that is the only way to connect. After that i pair with LESC with the peripheral. All this works, but then i try to do service discovery, with the command GATT services <address>, but this is where it doesn't work anymore. The nrf52 does not get a response. I am using a sniffer, Ellisys, and here's a snip of what is going on.

I think it is the nrf52, which is trying to read attribute handle 0, which is not possible. I am not that strong in BLE yet, therefore I'm not able to see myself what is going on. I am also confused about the specific attribute handle. 

And after this, it is stuck, it keeps trying to read on attribute handle 0.

Hope you can help.

Regards Andreas

  • So trying to come to some conclusions myself. Analyzing the code and the trace file, in cli_m.c, it has the handler for Service Discovery "cmd_services_discovery". It  uses the start handle 0x0001, and then it uses a function called "sd_ble_gattc_primary_services_discover", which is a function in the SoftDevice, if i have understood it correctly. 
    Then comparing to the trace file. First it send an ATT Read By Group Type Request, which is the service discovery, on handle 1, which is what is set in "cmd_services_discovery", after this, i can't figure it out since it is hidden in the SoftDevice, i believe. It goes to the next available handle, which is 31, then 157, and then it just makes an ATT Read, which I would believe is just a characteristic? Maybe? I'm fairly new to this Bluetooth show, so please correct me if i am wrong. It makes an ATT Read on handle 31, and then on 66, and after this one, it tries to make an ATT Read on handle 0, which is nonexistence, and that is not a legitimate handle, and again, please correct me if I am wrong.And now it's stuck on trying to make an ATT read on handle 0, which is not possible.

    Just trying to figure things out myself. 

  • I fixed it. It was because my peripheral had a lot of services, and the maximum services discoverable for the Nordic was 6, and that was set in the config file. Since it went over 6, it started to do weird things, like this, where it would ask for attribute handle 0.

Related