Platform reset function

⚠️
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 https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
moguilevski
Offline
Last seen: 3 weeks 3 days ago
Joined: 2019-04-30 12:25
Platform reset function

Dear Dialog team,

 

I use UART for communication between the DA14585 development kit and a development board from another manufacturer. In the case of the extensive data exchange the communication process interrupts sometimes by calling the platform reset function and gets stuck there. It happens while code is executed in a debug session. What would happen during the normal operation - when the image with the code is flashed on DA14585? How to avoid that the code execution gets stuck (watchdog is freezed during the UART communication)? The SW reset at this point would also work for me, however, as I see from the function content, the PRODUCTION_TEST macro must be defined for this which is not the case here. Is there any walk-around possible, without making changes in the SDK code?

void platform_reset_func(uint32_t error)
{
    uint16_t tmp;

#if (!PRODUCTION_TEST)
    // Trigger assert if the reset reason is other than RESET_AFTER_SUOTA_UPDATE
    ASSERT_WARNING(error == RESET_AFTER_SUOTA_UPDATE);
#endif
    // Trigger SW reset
    tmp = GetWord16(SYS_CTRL_REG);
    tmp = (tmp & ~REMAP_ADR0) | 0; // Map ROM at address 0
    tmp |= SW_RESET;
    SetWord16(SYS_CTRL_REG, tmp);
}

 

Device: 
PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi moguilevski.

Hi moguilevski.

Thanks for your question online. This meant that a platform reset takes place. Τhe platform_reset_func() is invoked by the platform_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.

Thanks, PM_Dialog

moguilevski
Offline
Last seen: 3 weeks 3 days ago
Joined: 2019-04-30 12:25
Thank you very much for the

Thank you very much for the detailed answer.

yykx
Offline
Last seen: 1 year 3 weeks ago
Joined: 2020-08-03 10:28
Hi 

Hi 

I meet difficulties about it, too. I reference the example code o"da14531-da14585-586_reading_i2c_accelerometer_ble". and run in to platform_reset_func().

in funtion void user_svc1_accel_X_send_ntf():

apply memory with the code:   

struct custs1_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, string_length);  

we running with small connection intervalas, if as you said,  insufficient memory, how to free the memory?

PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi yykx,

Hi yykx,

Thanks for your comment. It would be great if you could create a new forum thread with your issue.

You mentioned that you are using the da14531-da14585-586_reading_i2c_accelerometer_ble SW Example.

Have you done any modifications in the example, or you are using it as provided?

Please share that modification you have done.

What is the connection interval and the heap size? A possible solution might be to increase the connection interval or increase the heap size.

Thanks, PM_Dialog