Issue with app_easy_gap_undirected_advertise_get_active()

5 posts / 0 new
Last post
ankitdaf
Offline
Last seen:2 years 9 months ago
加入:2015-09-03 20:14
Issue with app_easy_gap_undirected_advertise_get_active()

Hi

I want to update the value of a characteristic when UART data is received. I am building on top of ble_app_barebone example, and modifying the long val of custs1 profile.

I have implemented uart2_read_completion_cb(uint8_t status) to trigger the update (with notification).

a. When I connect to the device with my Android app, read characteristics, and disconnect, it starts advertising again. This works reliably.
b. When I send connect to the device with my Android app, subscribe to notifications, send some data via UART, then disconnect, it does not start advertising again. I need it to advertise again for my application. I was able to figure out (with printf statements) that the following statements are the culprit :

struct gapm_start_advertise_cmd* cmd;
cmd = app_easy_gap_undirected_advertise_get_active();

The program does not proceed beyond the lines above (cmd = ..... ) when I run flow b.

Can you please tell me how to approach this and fix it, and what I might be missing ?

Thanks !

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2015-06-08 11:34
Hi ankitdaf,

Hi ankitdaf,

你可以disable sleep and step in the app_easy_gap_undirected_advertise_get_active() function in order to check what the problem is. Although i cant see any connections between the
notifications and the advertising procedure.

Thanks MT_dialog

ankitdaf
Offline
Last seen:2 years 9 months ago
加入:2015-09-03 20:14
I tested some more, and here

I tested some more, and here's what I found :

1. If I connect to the device and send out a custs1_val_ntf_req kernel message from the UART handler, then the device stops working after the first disconnect itself.
2. If I connect to the device, then disconnect, then connect again and then send out custs1_val_ntf_req from the UART handler, the device continues to work reliably after that even after disconnect, and I can keep on receiving the characteristic update notifications.

Based on the above, I am guessing that there must be some initialization / variable update happening when I first disconnect that makes the system stable. If I send a kernel message the very first time after a connection, the system does not work.

Does that give you any ideas?

P.S. I did not find which sleep and step you want me to disable..couldn't find them
Thanks

MT_dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2015-06-08 11:34
Hi ankitdaf,

Hi ankitdaf,

In order to debug your application you can't operate under sleep mode so you will have to disable it (in SDK5 in the user_config.h file the app_default_sleep_mode should have the ARCH_SLEEP_OFF value). You will have to debug your issue since i cant figure out why this may happen. Now regarding the initialization variable, when the disconnection occurs the gapc_disconnect_ind_handler() hits and the user custom callback is called in order to restart advertising (default operation), i dont see any initialization variable. The stuck issue could be a lot of things (NMI, Hardfault, platform_reset, or even the device isn't instructed to advertise so it does nothing).

Thanks MT_dialog

ankitdaf
Offline
Last seen:2 years 9 months ago
加入:2015-09-03 20:14
Hi !

Hi !

Thanks for the lengthy reply. On a hunch, I just typecasted the parameters to the kernel message as uint16_t, as some of them were declared as uint8_t. The system has been working reliably since !