Using MCUXpresso. I have the debug console working with the shell application. This uses getchar which is a blocking function. I want to convert the console to non-blocking. I added the project setting "DEBUG_CONSOLE_TRANSFER_NON_BLOCKING" to my project. I call "DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq)" and I am now calling the non-blocking function: IO_TryReceiveCharacter(). This function never returns any characters because UART_TransferGetRxRingBufferLength() never returns a size greater than zero. DbgConsole_Init calls UART_TransferCreateHandle() which sets UART_TransferHandleIRQ() but I do not get this interrupt which would place data in the ring buffer. Am I missing a initialization somewhere? Is there example code for a non-blocking console? Thanks.
Hi Glenn Kosteva
The TryGetchar API will go and check to verify if there is a new data and continue (in non blocking way), if it exists data, it will be saved. One way to use it could be
while (1) { //ch = GETCHAR(); DbgConsole_TryGetchar(&ch); if(ch) { PUTCHAR(ch); ch=0; } }
You can use the GETCHAR function which in low-level driver uses nonblocking functions. Another option could be implementing the UART nonblocking transfer.
Hope this helps.
Regards,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------