cancel
Showing results for 
Search instead for 
Did you mean: 

ST SensorTile -> Unable to set 128 bit service uuid in adv packet

NCras
Associate

Hi guys,

Trying to debug this issue. When I try to set a 128 bit service uuid in my advertising packet, I get 0x42 (invalid param) back from the BLE stack. Here's my call:

aci_gap_set_discoverable(ADV_IND, 0, 0, STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE, 8, localName, 17, servUuid, 0, 0);

servUuid is an array where the first byte is AD_TYPE_128_BIT_SERV_UUID. This should be a valid advertisement packet. The uuid I am providing is a valid UUID that has already been added to the db. If I set servUuid to NULL and the length to 0, the call works as expected.

Any idea?

-Nick

1 REPLY 1
Taxara
Associate III

Its an older thread, but i guess my answere could still help people. Since i coudnt find the solution when i ran into this same issue.

The method aci_gap_set_discoverable also sets (well atleast it does in v 1.4 ) flags and transmission power in advertising packet. Leaving too little space for your localname and servuuid to be added to the 31 bytes of advertising data.

Flags takes 3 bytes,

Transmission power takes 3 bytes.

Leaving 25bytes while you need 28 ((uuid + length + id) + (name + length + id))

The workaround i used is to use the aci_gap_set_discoverable like you did, then remove transmission power using aci_gap_delete_ad_type, and finish with an update of the entire advertising packet using aci_gap_update_adv_data.

If anyone has a better solution i would like to hear it!

Kind regards,

Taxara