Skip to main content

platform_reset_func in SDK6

3 weeks ago

platform_reset_func in SDK6

Posted byGreenTea100 points 3 replies
0 upvotes

Hello

The code below results in platform_reset_func() function.

How can I avoid the above reset function call?

All I am doing is calling arch_puts().

I know I do not need to print "timer stopped" many times but doing so makes the reset function call.

I want to measure the total time of reading few data from sensor device via I2C,and reading Analog input with ADC.

user_peripheral_setup.c

void start_timer(void)
{
arch_puts(“时间r started\r\n");
//systick_start(100,0);
}
void stop_timer(void)
{
// uint32_t time = systick_value();
// systick_stop();
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
arch_puts(“时间r stopped\r\n");
//arch_printf("elapsed time = 0x%x\r\n\r\n", time);
//arch_printf("systick value = 0x%x\r\n", systick_value());
}

void periph_init(void)

{

:

:

start_timer();
stop_timer();
start_timer();
stop_timer();
start_timer();
stop_timer();
start_timer();
stop_timer();

}

accepted answer!

3 weeks ago

PM_Dialog

Hi GreenTea,

Thanks for your question online. This assertion means that a platform reset occures. Τhe platform_reset_func() is invoked by the platform_reset(), which is implemented in the ROM code. The most probable reason for 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.

Regarding your attached code, the messages on the UART might be never consumed and this creates some kind of memory leakage.

Initially, I would recommend not printing the periph_init() function – you could pint into the application level (all files that start with user_* ).

In addition to this, please try to increase the MSG heap size – see this tutorial :http://lpccs-docs.dialog-semiconductor.com/Tutorial_SDK6/heap_usage.html

Thanks, PM_Dialog

2 weeks ago

GreenTea 100 points

Hello

Thank you for the reply.

I see how platform_reset() function is invoked.

The stop_timer() function which prints messages to UART doesn't invoke platform reset when it tries to print one line.

Trying to call start_timer() function and stop_timer() function in peripheral_init() function with many print messages, after calling couple of the start_timer(), stop_timer() function, invoked the platform reset function. ( without showing any messages on my serial communication terminal meaning it ran out of memory before the connection event arrived )

Thank you for your recommendation.

I tried using start_timer() function and stop_timer() function in the user_* function with printing only the messages needed, it is working without invoking platform reset function.

And Thank you for the tutorial.

2 weeks ago

PM_Dialog

Hi GreenTea,

Glad that you solved this and thanks for accepting my answer. If you have any other question, please raise a new forum ticket.

Thanks, PM_Dialog