嗨对话小组,
如果DEF_SVC1_BUTTON_STATE_CHAR_LEN较大,则DA14585芯片将溢出为24(字节),同时发送间隔每20ms(或更少),
请告知如何每20ms正确发送240个字节。
请参阅示例代码:
//更新按钮特征
struct susts1_val_ntf_ind_req * req = ke_msg_alloc_dyn(custs1_val_ntf_req,
prf_get_task_from_id(TASK_ID_CUSTS1),
task_app,
custs1_val_ntf_ind_req,
def_svc1_button_state_char_len);
req-> conidx = app_env-> conidx;
req-> notification = true;
req->handle = SVC1_IDX_BUTTON_STATE_VAL;
req->length = DEF_SVC1_BUTTON_STATE_CHAR_LEN;
req->value[0] = count++;
KE_MSG_SEND(REQ);
//Android Code
公共空白on特征(Bluetoothgatt Gatt,BluetoothGatt Characteristic特征)
{
super.onCharacteristicChanged(gatt, characteristic);
byte [] messageBytes = charactistististing.getValue();
Log.w(TAG, "onCharacteristicChanged: " + messageBytes.length); //packget show the currect MTU (tested upto 240bytes)
}
Regards,
ro
嗨罗伊哈,
我假设内存溢出位于DA14585侧。如果是的话,可以请说明代码卡在哪里吗?在platform_reset_func()中?
谢谢,PM_DIALOG.
Hi PM_Dialog,
是的,platform_reset_func pop with reset_mem_alloc_fail(0xf2f2f2f2)一个clasic内存溢出
Thanks,
ro
嗨罗伊哈,
Τ他platform_reset_func platfo()调用rm_reset(), which is implemented in the ROM code. The most possible reason why you get this assertion is due to insufficient memory, because you are allocating messages which are never consumed. For example, if you are allocating notification messages and you have a small connection interval the messages are piled up until a connection event arrives, but with a large connection interval your run out of memory before the connection event arrives. You could increase the connection interval. Probably, in your application there might be some kind of memory leakage pilling up after each connection, as the error code is RESET_MEM_ALLOC_FAIL. To do so, check if there are any pending messages and make sure that you are consuming the messages that you get when the message is handled or if you are allocating data they should be freed. For example, if you sampling the ADC and you are allocating messages in order to send the data over notifications as soon as there is a connection the device eventually will run out of memory, and if the device runs out of memory this will cause the device to reset. In addition try to increase the heap size by defining the DB_HEAP_SZ in the da1458x_config_advanced.h header file.
谢谢,PM_DIALOG.
嗨,
谢谢您的解释,内存溢出显然是根本原因的副作用。
我的问题是:如何每20ms发送240byte通知?
Thanks,
ro
Hi PM_Dialog,
只是要更多clear关于测试代码/设置:
1). Useble_app_all_in_one.在SDK 6.0.10.511中找到
2)。在user_custs1_def.h中编辑/更新定义为:#define def_svc1_adc_val_1_char_len 120
3)。编辑/更新user_app_adcval1_timer_cb_handler间隔到20ms
4)。编译和运行
预期结果:
实际结果:
请建议每20ms传输120字节数据到Android(优先考虑示例代码)是什么
*注意: 120byte every 20ms = 48Kbps well below the 1M limit
Regards,
ro
Example Code:
嗨罗伊哈,
我工作在SDK6.0.10的清晰BLE_APP_ALL_IN_ONE项目上,我使用了附加的代码片段。但是,我无法复制您的问题。变量“count”每隔20ms发送思想通知。你能在干净的ble_app_all_in_one项目中测试吗?你完成了任何其他修改吗?
谢谢,PM_DIALOG.
Hi PM_Dialog,
要重现问题,只需更改数据大小
从:
至:
#define def_svc1_adc_val_1_Char_Len 240.
Regards,
ro
嗨roie,
Just tested with 240 bytes size, but I am still unable to replicate it. Which the heap size that you are using? The default size is 2048 bytes. Can you please increase it?
谢谢,PM_DIALOG.
Hi PM_Dialog,
在使用#define db_heap_sz 2048后溢出在〜3,000 - 3,200包后
当使用#define db_heap_sz 2048 * 4 overflow以〜6,800 - 7,200数据包之后
Please note that whenAndroid Phone MTU is in default state(即20)db_heap_sz 2048 * 4是稳定的没有溢出after ~300,000 packets (I manually stoped it)
请建议您是否在测试台中使用Android手机?
If yes, Please share the Android version and example test code used.
*注意: The setup used here is: Samsung A5, S9 Android version 8, both phones both show the same behivior
Regards,
ro
嗨roie,
Let me ask you something for an extra clarification. Are you using a custom mobile application?
谢谢,PM_DIALOG.
Hi PM_Dialog,
是的,我正在使用自定义android应用程序。
还有很少的应用商店(例如,LightBlue等)的应用程序
任何推荐的测试应用程序,您可以分享的示例?
Regards,
ro
Hi PM_Dialog,
Any updates?
Regards,
ro
嗨roie,
Still I am not able to replicate it. Am working on that and I will let you know if there is any update. I will try to replicate it.
谢谢,PM_DIALOG.
Hi PM_Dialog,
请建议是否有任何我可以发送任何我可以发送到图的根本原因(例如:register dump,启用一些调试Printf标志等)
Regartds,
ro
嗨roie,
您可以使用BLE Sniffer工具来检查通过空中传输的数据包。
谢谢,PM_DIALOG.
Hi PM_Dialog,
我没有嗅探器,请建议购买/安装的工具
Regards,
ro
嗨roie,
Apologies for the delay. Propably I missed your last comment. Did you solve this issue?If your issue related with the DA14585, as mentioned this is due to inefficient heap size so you should increase it.
谢谢,PM_DIALOG.