cancel
Showing results for 
Search instead for 
Did you mean: 

aci_gatt_update_char_value return timeout when notify.

yuval
Associate II
Posted on August 28, 2016 at 17:17

Hi all.

I'm getting timeout from function:

aci_gatt_update_char_value(...)

even client get notify value as expected. description: Add Characteristic:

ret = aci_gatt_add_char(ServiceHandle, UUID_TYPE_128, uuid, 1,
CHAR_PROP_NOTIFY ,0,0,16, 0, &CharHandle);

I'm using NRF software to read characteristic values.(type ''nrf connect''in app store) Notify from server side by calling function:

aci_gatt_update_char_value (
 ServiceHandle , // service handle
CharHandle, // characteristic handle //
0, // characteristic value offset
1,// characteristic value length
&number; // characteristic

I'm getting the value in my cell phone but function

aci_gatt_update_char_value return timeout.

if i try to notify again, i'll get new value as expected but the same timeout error return on server side(my embedded ca
2 REPLIES 2
yuval
Associate II
Posted on August 29, 2016 at 09:06

Hi, i found the problem and it's a kind of ST firmware bug.

Explanation:

I'm using MQX OS.

All ST examples i found running HCI_Process() in while loop.

while(1)

{

  HCI_Process()

...

aci_gatt_update_char_value(...)

}

I'm using HCI_Process() running from separate task :

task_id = _task_create(...)

when start indicate/notify by : aci_gatt_update_char_value(...)

Inside this command there is a synchronization which waiting for this command to end:

...hci_send_req(struct hci_request *r, BOOL

async

)...

The issue:

Command: aci_gatt_update_char_value will finish only after getting acknowledge (sync).

But other task: HCI_Process() finish sync problem and make aci_gatt_update_char_value not to finish.

Command aci_gatt_update_char_value will enter timeout cause HCI_Process() ''still'' synchronization .

yuval
Associate II
Posted on August 29, 2016 at 09:15

solutions are:

1) add _time_delay(1) before HCI_Process();

2) or using code below:

task1{

g_start_indicate = true

  aci_gatt_update_char_value() ;

set_event(&events, START_INDICATE_EVENT_BIT);

}

task2{

        ...wait for event from interrupt....

if(g_start_indicate == true)

        {

            g_start_indicate = false; 

//wait for command to finish:

            wait_unlimited_event(&event, START_INDICATE_EVENT_BIT);

            clear_event(&events, START_INDICATE_EVENT_BIT);

        }

 HCI_Process();

}