Murata ZY with IoT SDK5 locked after out of range

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
11 posts / 0 new
Last post
gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Murata ZY with IoT SDK5 locked after out of range

Dear Dialog support,

I have ported the DA14583 IoT SDK to Murata ZY with DA14580.
Mostly I changed GPIO assignments, and so far most things work as expected.

However when connected e.g. with the IoT app, and then forcing the sensor out of range, it becomes unresponsive and a reset/power cycle has to be issued.
In the UART debug interface I can not observe a message following the event, especiallyDBG_MSG("DISCONNECTED\r\n");fromuser_on_disconnectdoes not appear (UART debug does work fine and shows other messages).

I am not aware to have modified any routines that could cause this behavior.
Could you assist me in tracing this issue?

Best regards
Johannes

Device:
gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Additionall findings:

Additionall findings:

1. I noticed thatgapc_disconnect_ind_handleris not executed when going out of range (but it is when I manually click "disconnect" in the IoT app).

PM_Dialog
Offline
Last seen:5 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Could you please clarify which your issue is since the gapc_disconnect_ind_handler when you manually click "disconnect" from the IoT application? Is this related with the out of range?

Thanks, PM_Dialog

gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

由于我不知道在追踪错误的地方开始,我随机搜索了与断开连接相关的函数调用的代码,并将UART调试输出放到了它们是否被执行。这gapc_disconnect_ind_handlerwas the first function I investigated.
I compared the situation "regular disconnect" vs. "out of range disconnect".

Please let me know which are the proper functions that I should investigate, to find out where it freezes.

BR Johannes

PM_Dialog
Offline
Last seen:5 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Could you please run the firmware in debug mode, hot attach the debugger and try to find where the code gets stuck?

Thanks, PM_Dialog

gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,
unfortunately I never got JTAG/SWD running (see alsohttps://support.dialog-semiconductor.com/comment/20501#comment-20501).
我希望你能向我描述的行为in the SDK following and out-of-range disconnection, such that I have a chance to investigate it only with UART, but without debugger.
Best regards
Johannes

gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Dear PM_Dialog,

Dear PM_Dialog,
I got debugging with SWD running.
Please see attached screenshot where the code seems to stop.
Is there more information I can provide?

Best regards
Johannes

Attachment:
PM_Dialog
Offline
Last seen:5 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi gme_johannes

Hi gme_johannes

这most obvious reason that the wrap_platform_reset() is occurred is due to memory allocation failure, which means that there is a memory leakage in your software, you allocate data somewhere and you never release them (you can verify that in the parameter error of the function, which should be RESET_MEM_ALLOC_FAIL). Selecting the optimal heap for your application, you should experiment with via changing the sizes of the heaps in the da1458x_config_advanced.h file. There is nothing wrong with the memory allocation, but it depends how much memory you are trying to allocate, apparently you are trying to allocate more memory than what is available and you get that assertion. Could you please make sure that the firmware gets stuck into the wrap_platform_reset()?

Thanks, PM_Dialog

gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

indeed the error is RESET_MEM_ALLOC_FAIL.

I have added very little code to the original IoT project, mainly to handle two more LEDs.

I am using EXTENDED SLEEP, such that the heap size should be calculated automatically, correct? So, what can I modify?
When I execute the code and force out of range for BT, the debugger will stop in the wrap_platform_reset(), yes.

BR Johannes

gme_johannes
Offline
Last seen:4 days 6 hours ago
Joined:2017-12-22 10:09
I have modified the heap size

我在da1458x_scatter_config中修改了堆大小:

// #define DB_HEAP_SIZE (1024 + 12) #define DB_HEAP_SIZE (1536 + 12)

and now I do not see the issue anymore.
Nonetheless I would like to know how to determine the appropriate value. How was "1024" chosen?

How can I test that the heap size is enough for my application?

BR Johannes

PM_Dialog
Offline
Last seen:5 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Glad that you figured your issue out. There is not any specific way to determine the appropriate value. The value of the heap size should be decided experimentally.

Thanks, PM_Dialog