Non-blocking printf

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Non-blocking printf

1,343 Views
oaf
Contributor IV

I'm running KSDK-1.1.0 and made a bad discovery today.

printf() via many calls ends up in UART_DRV_SendDataBlocking()

How could I configure my system so that UART_DRV_SendData() is used instead.

 

In KSDK-1.0.0 it was user configurable to have IRQ/Polled devices ("ittya:" / "ttya:"),

from what I could figure out from GDB this is no longer the case, it seems that the

device is IRQ-driven, but what is the point if it's still waiting to get the TX done???

Labels (1)
Tags (2)
0 Kudos
2 Replies

679 Views
Rick_Li
NXP Employee
NXP Employee

Hello Asbjorn Fadum,

The configuration of IRQ/Polled device ("ittya:" / "ttya:") is a way used by MQX. It seems that your KSK-1.0.0 project is a MQX project.

For KSDK, the DbgConsole is configured by calling DbgConsole_Init() (this is done in hardware_init.c) which will pass the user configuration structure and then stdout and stdin will be connected to the seleted UART/LPUART.

In fsl_debug_console.c which is located in {KSDK}\platform\utilities\src, you will see that printf() will finally call UART_HAL_SendDataPolling() to output string.

Changing UART_HAL_SendDataPolling() to UART_DRV_SendData() will cause printf() not to work.

hope it helps!

0 Kudos

679 Views
oaf
Contributor IV

Hi,

Well my problem is that it seems that printf is sending one character at a time to the UART device, then despite the fact that the UART in itself is IRQ-driven doesn't help as printf will stall my task.

When I'm using PEx for HC12 the printf sends all bytes to a buffer controlled by the UART device-driver, and the driver will then output the characters on IRQ. Is this possible to configure some how

on Kinetis, using PEx?

0 Kudos