Hello Marco,
About your first question, I can say, yes, you can, and I've made some modifications on lwip_udpecho_demo_mqx_twrk65f180m example to validate it. I attach this main.c file for your reference but I will explain all that I've done in order to get this UART driver to work.
First of all, I included the "fsl_uart_driver.h" file.
#include "fsl_uart_driver.h"
Then, I defined UART 3's handler as it is explained on this document:How To: Using Interrupt Handlers in MQX with KSDK (You can also check this useful post Interrupt handling with KSDK and Kinetis Design Studio)
extern void UART_DRV_IRQHandler(uint32_t instance);
void MQX_UART3_RX_TX_IRQHandler () {
UART_DRV_IRQHandler(3);
}
After this, on Main task, I configured the UART module (pins, baud rate, etc) and all necessary variables:
const uint8_t buffStart[] = "\r\n++++++++++++++++ UART Send/Receive Blocking Example +++++++++++++++++\r\n";
// Inform to start blocking example
uint32_t byteCountBuff = sizeof(buffStart);
// Initialize variable uartState of type uart_state_t
uart_state_t uartState;
// Fill in uart config data
uart_user_config_t uartConfig = {
.bitCountPerChar = kUart8BitsPerChar,
.parityMode = kUartParityDisabled,
.stopBitCount = kUartOneStopBit,
.baudRate = 115200
};
/* UART3 pins on PTE4 and PTE5 */
/* Affects PORTE_PCR4 register */
PORT_HAL_SetMuxMode(PORTE,4u,kPortMuxAlt3);
/* Affects PORTE_PCR5 register */
PORT_HAL_SetMuxMode(PORTE,5u,kPortM
uxAlt3);
UART 3's handler is installed through OSA layer:
OSA_InstallIntHandler(UART3_RX_TX_IRQn, MQX_UART3_RX_TX_IRQHandler);
Finally, I initialize the module and send a basic message:
if (kStatus_UART_Success != UART_DRV_Init(UART3_IDX, &uartState, &uartConfig)) {
printf("Error on UART initialization\r\n");
} else {
UART_DRV_SendDataBlocking(UART3_IDX, buffStart, byteCountBuff,1000);
}
After this, demo is unaltered and you can see that both UART instances (UART2 as I/O console and UART3) print messages on terminals:

This way, you can see that UART can be used as it is used on baremetal examples.
About second point, the way to do it is through NIO (I know about the lack of documentation on this abstraction) but you can base on NIO driver that is used to install default console on MQX system. I can try to explain it deeper if you desire so.
For now, I hope this can help you!
Best Regards,
Isaac
----------------------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------------------------