Skip to main content

arch_printf doesn't work for app_on_ble_powered callback

1 month ago

arch_printf doesn't work for app_on_ble_powered callback

Posted byvuk102045 points 3 replies
0 upvotes

I'm not able to get arch_printf to work when using app_on_ble_powered callback till I move arch_printf_process(); above the last if-statement inside schedule_while_ble_on. I have come across threads from 5 years ago reporting this. Is this still an issue or am I doing something wrong?

If it's still an issue it would be great to get this fixed ASAP. It's taking up people's time while it was reported 5 years ago.

1 month ago

PM_Dialog

Hi vuk1020,

Thanks for your question online. Unfortunately, I am not able to replicate this. Could you please share the user_on_ble_powered() callback function that you are using, so that I can reproduce it? Which SDK project are you using?

Thanks, PM_Dialog

1 month ago

vuk1020 45 points

Hi,

I'm currently on SDK6.0.14 and using DA14585 basic dev kit. To reproduce I recommend the following:

1) download the DA14585-DA14586-DA14531_Central_Implementation from the website

2) Implement the following user_app_on_ble_powered in user_central_app.c and declare in user_central_app.h

arch_main_loop_callback_ret_t user_app_on_ble_powered(void)
{
arch_printf("Hello World\r\n");

//Reload watchdog
wdg_reload(WATCHDOG_DEFAULT_PERIOD);

return KEEP_POWERED;
}

3) enable UART2 by following below steps:

  1. define the CFG_PRINTF in the da1458x_config_basic.h
  2. use the arch_printf() API in order to print messages to the uart
  3. include the arch_console.h file in order to use the above API for printing messages
  4. configure HW for UART

4) change the baud rate to 460800

If I don't make the described change in my previous message in arch_main.c I get an error, about one second after start: ASSERT_WARNING(error == RESET_AFTER_SUOTA_UPDATE). If I make the change everything seems to be working.

1 month ago

PM_Dialog

Hi vuk1020,

只是复制。这是一个平台再保险set - platform_reset_func(). The most possible reason why you get this assertion is due to insufficient memory, because you are allocating messages which are never consumed. Please check the return KEEP_POWERED to GOTO_SLEEP in user_app_on_ble_powered().You should only return GOTO_SLEEP if you UART is completely finished.

Thanks, PM_Dialog