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

sd_ble_gatts_value_get returns 0 first time

I always read 0 first time I call sd_ble_gatts_value_get(), the second time and forward I read correct value. Even if I call sd_ble_gatts_value_get() twice in a row the first time after reset it returns 0 and second time correct value. But I get the correct length even the first time. p_value is set like:

uint8_t value_test[5];
ble_gatts_value_t test; 
test.p_value = value_test;

This happens even if I call sd_ble_gatts_value_get() 5 min after reset. And in the meantime I can write and read the char value with other device with no problem.

Related