con_interval >= user_connection_param_conf.intv_min) && (msg_param->con_interval con_latency == user_connection_param_conf.latency) && (msg_param->sup_to == user_connection_param_conf.time_out)) { // my code app_easy_gap_disconnect(app_env[0].conidx); // Send disconnect command } } break; But the variables msg_param->con_interval , msg_param->con_latency , msg_param->sup_to have always the same value. My second idea was to catch the following message GAPC_PARAM_UPDATE_CFM // Master confirm or not that parameters proposed by slave are accepted or not But without success. Maybe it is the wrong place to catch this message in the "user_catch_rest_hndl()" or Android did not send this message. The third and last idea is to read the actual connection parameters direct, but where are they ? Thanks in advance with best regards Siegmar"> DA14580 "GAPC_PARAM_UPDATED_IND" | Dialog - 亚博全网,亚博电竞菠菜,亚博国际官网平台网址 Skip to main content

DA14580 "GAPC_PARAM_UPDATED_IND"

4 months ago

DA14580 "GAPC_PARAM_UPDATED_IND"

Posted byomesa0 points 7 replies
0 upvotes

Hello,
at first I wish all a better New year as the last one.
I have the following problem :
My application is a ultra low power sensor. When my Adroid App is connected to the device, I have to change the connection parameters as quick as possible to save energy, because I get every 10s a new data.
In a special measurement procedure, I will get every 1 s a new data.
So, I have to changed the connection parameters from time to time.
This is working like expected.
But in my DA14580 code, I want to be sure, that the new connection parameters are excepted by the the master ( Adroid App ) or not. If the connection parameters are not right, I have to disconnect the communication.

My project is based on the " ble_app_sleepmode project "

所以我的第一个想法是赶上以下message in the "user_catch_rest_hndl()".

case GAPC_PARAM_UPDATED_IND:
{
// Cast the void pointer to the appropriate message structure
struct gapc_param_updated_ind const *msg_param = (struct gapc_param_updated_ind const *)(param);

// Check if updated Conn Params filled to preffered ones
if ((msg_param->con_interval >= user_connection_param_conf.intv_min) &&
(msg_param->con_interval <= user_connection_param_conf.intv_max) &&
(msg_param->con_latency == user_connection_param_conf.latency) &&
(msg_param->sup_to == user_connection_param_conf.time_out))
{
// my code app_easy_gap_disconnect(app_env[0].conidx); // Send disconnect command
}
} break;

But the variables msg_param->con_interval , msg_param->con_latency , msg_param->sup_to have always the same value.

My second idea was to catch the following message GAPC_PARAM_UPDATE_CFM // Master confirm or not that parameters proposed by slave are accepted or not
But without success.

Maybe it is the wrong place to catch this message in the "user_catch_rest_hndl()" or Android did not send this message.

The third and last idea is to read the actual connection parameters direct, but where are they ?

Thanks in advance

with best regards
Siegmar

4 months ago

PM_Dialog

Hi omesa,

The GAPC_PARAM_UPDATED_IND event is getting triggered once the connection parameters have been updated. If the master ( mobile phone ) accepts the parameters, then the GAPC_PARAM_UPDATED_IND should be sent to the application as soon as the parameters are updated. If you check the SDK examples, you will see that the GAPC_PARAM_UPDATED_IND is caught in user_catch_rest_hndl(). You should be able to get the update parameter indication by catching the GAPC_PARAM_UPDATED_IND, in the app_process_catch_rest_cb() but again this indicates that the connection parameters have already changed by the master. You cannot catch the message before the new parameters are applied to the connection. Can you please add a break point to check if you can get this message? If yes, the parameter have been updated. Please check this out with the usage of the Power Profiler from the SS Toolbox.

If you are starting a new design / project, we would strongly recommend to start with DA14531 or DA14585/586 products and our latest SDK6.0.14, as it is much more improved. We have a lot of code examples and improved documentation, and there is also software roadmap support. There is no software roadmap support for DA14580 product family and SDK5.

Thanks, PM_Dialog

4 months ago

omesa 0 points

Hi,

thanks for your quick reply.

At first it is not not a new design. It is working and maybe in 6 months I will port the software to the new hardware.

But know I have the problem.

Of course, I know how to set an breakpoint ;-)

But the variables msg_param->con_interval , msg_param->con_latency , msg_param->sup_to have always the same value.

msg_param - > con_interval = msg_param - > con_latency !!

For your information, I am working more than 2 years with the DA14580 chip .

It will be nice, if you give me the right direction.

cheers

Siegmar

4 months ago

PM_Dialog

Hi omesa,

Thanks for the clarification. What I meant, was just to check it the breakpoint hits to this point. After the connection parameter request, are you able to see that the connection interval has been updated?

When the GAP peripheral device sends a connection parameter update request to the GAP Central, according to Bluetooth LE specs, the GAP Central decides if the request can be accepted or rejected.

If it is rejected, the app_on_update_params_rejected (by default it is NULL) will be triggered. So, you can remove the NULL and implement your application code. Please follow the implementation from the other user callbacks.

If it is accepted, you can do the same with the app_on_update_params_complete callback. Please see user_app_callbacks() in user_callback_config.h .

For example :

.app_on_update_params_rejected = user_app_on_update_params_ rejected , .app_on_update_params_complete = user_app_on_update_params_complete,

In in user_XXXX.h file (for example user_periph.h)

void user_app_on_update_params_ rejected (void); void user_app_on_update_params_complete(void);

In in user_XXXX.c file(for example user_periph.c)

void user_app_on_update_params_ rejected (void) { …. …. } void user_app_on_update_params_complete(void) { …. …. }

As mentioned before, the GAPC_PARAM_UPDATED_IND event should be triggered when the parameters of the connection have been updated. Do you need to read the new connection parameters?

Thanks, PM_Dialog

4 months ago

omesa 0 points

thank you very much for your reply and for giving me an direction.

"As mentioned before, the GAPC_PARAM_UPDATED_IND event should be triggered when the parameters of the connection have been updated. Do you need to read the new connection parameters? "

I want to be sure, that the connection parameters are correct. Maybe I can test it from the Android Master, but it is better that the slave can control it by himself.

I will start today with my investigation.

cheers

Siegmar

4 months ago

PM_Dialog

Hi Siegmar,

You could use the suggested callback in case the Master accepts or rejects the update parameter request.

Thanks, PM_Dialog

accepted answer!

4 months ago

omesa 0 points

Hi,

thanks so much, for giving me the right direction. It is working like expected . When the connect parameters are not excepted by the master, I can disconnect the connection in the callback function void user_app_on_update_params_ rejected (void) with app_easy_gap_disconnect(app_env[0].conidx);

So my problem is gone, thanks

With best regards

Siegmar

accepted answer!

4 months ago

PM_Dialog

Hi Siegmar,

Glad that you got it working. If you have any follow up question, please raise a new forum post.

Thanks, PM_Dialog