Configuring FlexIO UART for FRDM-KL43Z with baudrate <115200bps

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

Configuring FlexIO UART for FRDM-KL43Z with baudrate <115200bps

734 Views
dvalerio
Contributor II

Hello! I am trying to configure the FlexIO as UART with baudrate less than 115200 in a FRDM-KL43Z, but I can´t do it.

I am using the SDK example called: flexio_uart_interrupt_transfer.c , for MCUXpresso IDE.

I was reading some posts that it is needed to decrease the Clock Frequency to make the divider less than 0xFF to use it in the TIMER_CMP. 

As my clock frequency is 48MHz, and my baudrate less than 115200, the timer value is bigger than 0xFF; the code implemented uses this:

timerDiv = srcClock_Hz / userConfig->baudRate_Bps;
timerDiv = timerDiv / 2 - 1;

if (timerDiv > 0xFFU)
{
result = kStatus_InvalidArgument;
}

So, as timerDiv is bigger than 0xFF, it returns invalid argument.

How can I  configure the clocks and the flexio to work with baudrates lower than 115200 bps?

Best regards.

D.

0 Kudos
1 Reply

585 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Diego Valerio,

The baud rate divider equal to (CMP[7:0] + 1) * 2, the maximum of CMP[7:0] is 0xFF,

so the if use 48MHZ source clock, the minimum baud rate is

srcClock_Hz/((CMP[7:0]+1)*2) = 48000000/( (0xff+1)*2) = 48000000/512 = 93750HZ.

If you want to low the baud rate ,  you can choose low flexio  source clock:

pastedImage_285.png

Hope it helps,


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------