Hi everyone,
I'm working on an NXP project that involves reading ADC values and transmitting them over UART, and receiving responses from a co processor over UART. I'm using the FRDM-MCXW71 evaluation board and have encountered an issue where the UART RX read flags don't seem to work as expected when sending data to the RX line.
The RX read flag (kLPUART_RxDataRegFullFlag) isn't triggering during runtime when I send data to the RX pin. This suggests that incoming data isn't being flagged for processing even though the UART peripheral is initialized and configured correctly.
When I switch to using blocking reads via LPUART_ReadBlocking, the UART receives data without any issues. This confirms that the hardware setup and basic UART functionality are working fine.
Here’s the working example using LPUART_ReadBlocking:
uint8_t data[10];
LPUART_ReadBlocking(LPUART0, data, sizeof(data));
PRINTF("Received: %s", data); Here’s the part of the UART setup code:
static void configureLPUART(void)
{
lpuart_config_t config;
LPUART_GetDefaultConfig(&config);
config.baudRate_Bps = UART_BAUD_RATE;
config.enableTx = true;
config.enableRx = true;
LPUART_Init(LPUART0, &config, DEMO_LPUART_CLK_FREQ);
LPUART_EnableInterrupts(LPUART0, kLPUART_RxDataRegFullInterruptEnable);
} However, checking LPUART_GetStatusFlags(LPUART0) & kLPUART_RxDataRegFullFlag doesn't seem to indicate any data received, even when valid data is sent to RX.
Mex config
Has anyone experienced similar issues with the RX flags not being triggered? Could this be related to clock settings, buffer configuration, .mex config or something I might be overlooking in the LPUART setup?
Any insights would be greatly appreciated!
Thanks in advance!
Andrew
Hello @andrtnnr
Thanks for your question.
Do you want to use Interrupt mode or Polling mode? If interrupt, please refer to lpuart_interrupt_transfer under SDK demo. It calls RX read flag (kLPUART_RxDataRegFullFlag) .
BR
Alice
Thanks @Alice_Yang . I have this demo running and receiving data.
But I have a problem with understanding how to modify the example to fit my needs. I want to use this similar to an Arduino serial call like Serial.Available() but this one seems to wait until the rx buffer size hit its limit (in this example its 8 characters). How would I trigger a read if I want to read once my coprocessor is done sending regards if its hits the limit.