SOC reset sometimes when pair with cellphone : wrap_platform_reset()

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
bigheadbaby
Offline
Last seen:2 years 5 months ago
Joined:2017-12-14 13:52
SOC reset sometimes when pair with cellphone : wrap_platform_reset()

hello dear dialog staff:
I have a problem about wrap_platform_reset(), my customer said sometimes he connect Soc with the cellphone , soc will call wrap_platform_reset() and return error code 0xF2F2F2F2
I find some explanation which said :
/*
the most obvious reason for the wrap_platform_reset to occur is due to memory allocation failure, that means that there is a memory leakage in your sw, 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).
*/

I checked the heap assignment:
RAM_BSS_1 0x00815000
{
*(ke_heap)
}
ScatterAssert(ImageLength(RAM_BSS_1) < 0x3000)
}
which means 12k is used for heap allocation. is it enough?
If there is a memory leakage in my sw, it will reset when that malloc is triggered and more heap space will not help with the reset problem?
How can i find them and when I need to release these memory? actually this comfused me a lot . is there any application note can help me understand the ke melloc mechanism .

thanks~

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi bigheadbaby,

Hi bigheadbaby,

Regarding the heap allocation you will be able to find how much heap is allocated for the kernel messages in the .map file (search for the heap_db_area, heap_env_area, heap_msg_area). A 0x3000 heap is very large and i seriously doubt if this indicates your heap size. If there is a memory leakage in your sw and you keep allocating memory then yes at some point when allocating memory you will end up in the wrap_platfrom_reset. There is no specific way to find out where the memory leakage is. If you are using ke_malloc in order to allocate room, you should allocate from the non_ret_heap and you should free the space using ke_free() as soon as you dont need that room any more and also make sure that all the message handlers return KE_MSG_CONSUMED in order for the allocated space to be freed.

Thanks MT_dialog

bigheadbaby
Offline
Last seen:2 years 5 months ago
Joined:2017-12-14 13:52
Dear MT_DIALOG:

Dear MT_DIALOG:
thanks for your explanation.
it seems that I have found some possibility why it will cause a reset
we put some delay in while(1) main loop and I guess the funcion rwip_schedule() can not work well with it ......
for example ,if I want to use GPIO to fullfill a software IIC function, it seems that delay function will cause a reset... does it mean I cant put any delay action in main loop?
If I can, maybe I must turn off the msg that will induce memory leackage, I guess advertising may bring on some msg periodly and finally give rise to a reset. close adv action will help with this problem?? Is there any other msg may cause a reset when im not connecting with soc. then i think delay in main loop may become possible.
thanks~~~

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

Hi bigheadbaby,

Could you please let me know why you put a delay into the while(1)? Is there any specific reason why you added a delay? Be aware that it is strongly recommended to NOT add any delay into this function. The reason is that the schedule_while_ble_on() function invokes the rwip_schedule() function, that serves all the pending messages. If you put a delay into while(1) this means that the schedule_while_ble_on() will be delayed too but the queue will continue receiving messages, so scheduler will have to reserve many of them. As a result, you will get the wrap_platform_reset()

Thanks, PM_Dialog

bigheadbaby
Offline
Last seen:2 years 5 months ago
Joined:2017-12-14 13:52
Many thanks ~

Many thanks ~
At last ,Please do help me understand the function rwip_schedule(), ~~~~~HELP~~~~~
i will try to avoid delay function in while1 according to our software architecture.
I have done a test, Im now quiet sure that if adv is on , through i put a long delay in while 1, ke_malloc is called periodly but rwip_schedule() can only run after delay is finished.
but im thinking that rwip_schedule() is a while loop to find callbacks to deal these msgs,
-------------------------------------------
Does it mean it will finish dealing with all the messages once in a time , or it can not which will finally cause a memory accumulation ???
-------------------------------------------
If rwip_schedule() can finish all the messages and release memory in time, is there any reason that can cause this error , I just want to know more about the KE schedule mechanism , Please offer me some details if you can. if there is some pdf notes that can help me understand this, please imform me also
thanks again

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

Hi bigheadbaby,

The DA14580 only schedules the pending messages while the BLE core is active and when the rwip_schedule() function executes. Messages can be sent asynchronously towards the stack but they will be served synchronously when the rwip_schedule gets executed. In the active part of the main loop, the kernel will be granted control with a call to rwip_schedule() and it will keep the control for as long as messages and events need to be handled. The call to rwip_schedule() happens in schedule_while_ble_on() since the kernel requires the BLE hardware to be active to process messages. I would highly recommend you to have a look into 7.2.1 Main Loop Callbacks paragraph ofUM-B-051 : DA14580 Software Platform Reference (SDK5)用户手册。你能找到并下载它our support portal. Regarding your issue, I am not able to understand what you exactly mean, so can you please clarify your question? Do you still have this error?

Thanks, PM_Dialog

bigheadbaby
Offline
Last seen:2 years 5 months ago
Joined:2017-12-14 13:52
thanks

thanks
but I cannot find where to download this application note, UM-B-051 : DA14580 Software Platform Reference (SDK5) user manual
I click the link you gave me but only these info are shown:

--------------------------------------------------------------
Version date: 20/12/2016
Version number: 1.2
Tutorials:

Receive update notifications
Subscribe to this page
The master checkboxes in the left-most column turn the given subscription on or off. Depending on the setup of the site, you may have additional options for active subscriptions.--------------------------------------------------------------

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

Hi bigheadbaby,

You are not able to download it because you haven’t accepted theSoftware License Agreement (SLA)yet. Please try to download it again and hit into the padlock that will appear from the download. After that you will have to agree with theLicense Agreement和你应该等到你的访问granted.

Thanks, PM_Dialog

bigheadbaby
Offline
Last seen:2 years 5 months ago
Joined:2017-12-14 13:52
I still dont know where to

I still dont know where to find this SLA
Is a mail access can I reach this link?

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

Hi bigheadbaby,

Please go to product DA14580 and navigate to software and tools. Then try to download the SDK. There you 'll have to see a padlock icon - click that, accept the agreement, and you will be granted will SDK access in a couple of days.

Thanks, PM_Dialog