14个帖子/ 0新
Last post
Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
Dialog disconnects

Not sure what to do about the following situation:
Dialog is running fine connected to the app.
When we move away from the sensor and chip the RSSI changes as expected.
Suddenly it seems that the dialog disconnects and the only way we can connect again is by restarting the device.

We could send a disconnect message to the chip from the app when the RSI level is too low and tell the user to get closer, but is there a more elegant solution?
Thanks

Device:
MT_dialog
Offline
Last seen:1 month 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rony,

Hi Rony,

You dont have to send a disconnection message from the device to the chip...when the device is of range you will have a GAPC_DISCONNECT_IND by using the gapc_disconnect_ind_handler() you can re-advertise your device from that function.

Thanks MT_dialog

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
If I understand correctly the

If I understand correctly the GAPC_DISCONNECT_IND activates the gap_disconnect_ind_handler in my profile task.
BTW we have based our solution on sample128.
I have a breakpoint in gap_disconnect_ind_handler.
I reach the breakpoint when the android app is disconnecting but not when the device is out of range.
Is it possible that a handler is activated somewhere else in this case?
Thanks

MT_dialog
Offline
Last seen:1 month 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rony,

Hi Rony,

The handler should be activated when the peripheral is out of range with reason 0x08. The handler activated is gapc_disconnect_ind_handler as defined in the app_task_handlers.h. Please try to verify this with a default version of the sample128 project.

Thanks MT_dialog

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
This is the handler in app

This is the handler in app_task.c
int gapc_disconnect_ind_handler(ke_msg_id_t const msgid,
struct gapc_disconnect_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
app_disconnect_func(dest_id, param);

return (KE_MSG_CONSUMED);
}

I get there when the android app disconnects but I don't get there when the chip is out of range

MT_dialog
Offline
Last seen:1 month 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rony,

Hi Rony,

Yes, this should not happen, the indication should be activated not instantly but when the suppervision timeout expires.

If you stop the debugging when the central is out of reach where the code ends up ?

Please place a break point to the platform_reset function to see if the code ends up there.

Thanks MT_dialog

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
where is platform_reset?

where is platform_reset?
Found it in the jump tables but couldn't find the code.

MT_dialog
Offline
Last seen:1 month 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rony,

Hi Rony,

Have you checked where the code goes after the peripheral is out of reach from the central ?

Forgot to mention that you have to implement your own custom function (my_platform_reset_func) and replace the platform_reset_func in the jump table. Then place a breakpoint in your custom function in order to see if the platform reset function is issued.

Thanks MT_dialog

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
When out of range the program

When out of range the program stops.
拆卸在地址0
the command window has a warning:
CPU无法停止
and the a series of :
jlink error: can not read register xx while cpu is running

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
Do you have an example of the

Do you have an example of the implementation of (my_platform_reset_func) to see how it is done?

MT_dialog
Offline
Last seen:1 month 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rony,

Hi Rony,

Just replace the normal function in the jump table with a custom one in order to place a breakpoint and catch it.

它年代eems though that your program is going to platform reset judging from your #9 post. The fact that you lose your debugger is a strong indication. As far as i can undestand you are running out of memory when the peripheral goes out of range or you are allocating memory without freeing it. I suppose that the messages from the peripheral are pilling up until the supervision timeout, and a platform reset is issued before the gapc_disconnect_ind_handler is invoked. If that is the case you have to implement some kind of flow control in your device.

Thanks MT_dialog

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
Tried to replace in jump

Tried to replace in jump_table.c but failed on the build.
Please tell me exactly where to change it.

Regarding the flow control I will try to implement one.
Thanks

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
Made some progress.

Made some progress.
Added my reset function and got called with error=0xf2f2f2f2

这是什么意思?

Rony
Offline
Last seen:4 years 10 months ago
Master
加入:2014-05-15 15:02
I guess you solved it.

I guess you solved it.
Added logic that counts number of notifications as sent by the application versus those sent by profile.
When difference is 9 I stop sending and resume when the android app tells me so.
Works fine.
Thanks for the help

Topic locked