Hi Dialog,
I have setup UART2 for arch_printf on the following GPIO
#ifdef CFG_PRINTF_UART2
#define GPIO_UART2_TX_PORT GPIO_PORT_0
#define GPIO_UART2_TX_PIN GPIO_PIN_6
#define GPIO_UART2_RX_PORT GPIO_PORT_0
#define GPIO_UART2_RX_PIN GPIO_PIN_7
#endif
and I defined
#define CFG_PRINTF
However, I did not get any printing before I moved the loaction of "arch_printf_process();" in the function "schedule_while_ble_on(void)", which now looks like this
static inline void schedule_while_ble_on(void)
{
// BLE clock is enabled
while (ble_is_powered()) {
// BLE event end is set. conditional RF calibration can run.
uint8_t ble_evt_end_set = ke_event_get(KE_EVENT_BLE_EVT_END);
//execute messages and events
rwip_schedule();
//
if (ble_evt_end_set)
{
uint32_t sleep_duration = 0;
rcx20_read_freq ();
//if you have enough time run a temperature calibration of the radio
if (lld_sleep_check(&sleep_duration, 4)) //6 slots -> 3.750 ms
// check time and temperature to run radio calibrations.
conditionally_run_radio_cals();
}
// My move of arch_printf_process()
arch_printf_process ();
//grant control to the application, try to go to sleep
//if the applciation returns GOTO_SLEEP
if (!app_asynch_trm())
break;
//SDKIMPROVEMENTS Needs testing!! We can add the following condition and move
// it out of the loop
// we may consider putting it in before the app_asynch_trm
//if (GetBits16(CLK_CTRL_REG, RUNNING_AT_XTAL16M))
// execute the printf process
//moved up arch_printf_process();
}
}
With this modification arch_printf works.
Info: My user_app_main_loop_callbacks.app_on_sytem_powered is NULL, so schedule_while_ble_on returns before reaching the original location of arch_printf_process();
Is this a bug in the SDK (wrong placement of "arch_printf_process();" in the function "schedule_while_ble_on(void)") , or am I doing something wrong?
If I am doing this wrong, then how should I do this?
Thank you in advance.
Best Regards,
Ciano Frost
Denmark.
Hi ciano,
Yes, its a bug on the SDK, as you noticed is a wrong placement of arch_printf_process(), please check this post also:
http://support.dialog-semiconductor.com/sdk-5-uart
Thanks MT_dialog