How can i change the baud rate on the LPUART module on KL27Z

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i change the baud rate on the LPUART module on KL27Z

305 Views
Contributor II

Hi 

Im working with the LPUART module at 115200 bauds, but in an specific moment i need to change it to 57600 bauds. Then i have to return it to 115200 bauds.

How can i do it.

I have initialized it with processor expert at 115200 bauds.

Thanks 

José

Labels (1)
Tags (2)
5 Replies

79 Views
Specialist V

Hi Jose

// Change from 115.2k to 57.6k
LPUARTx_BAUD = ((LPUARTx_BAUD & ~LPUART_BAUD_SBR) | ((LPUARTx_BAUD & LPUART_BAUD_SBR) * 2));
// Change from 57.6k to 115.2k
LPUARTx_BAUD = ((LPUARTx_BAUD & ~LPUART_BAUD_SBR) | ((LPUARTx_BAUD & LPUART_BAUD_SBR) / 2));

x is LPUART channel
LPUART_BAUD_SBR is 0x1fff

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

79 Views
Contributor I

The LPUART supports dual clock domains allowing for wake up MyWawaVisit from stop modes and baudrate programming independent of the peripheral clock mywawavisit.

0 Kudos

79 Views
Senior Contributor II

One way to do this is directly writing to the UART clock prescaler register from your application.

Or: set the baud rate to 'list of values' (I'm not having a KL27Z, but I'm doing that with the KL25Z):

pastedImage_1.png

Then use SetBaudRateMode:

pastedImage_2.png

0 Kudos

79 Views
Contributor II

Hi Erich, thanks for answering

I searched in processor expert the AsynchroSerial component, but i cant find it to kl27Z. 

I also looked at the LPUART configuration in processor expert and cannot add more baud rates to the list.

pastedImage_1.png

Do you know what could be the solution?

Thanks

0 Kudos

79 Views
Senior Contributor II

Can you change the drop box of the 'Runtime settings type' to 'list of values'? Then you should be able to add more rates.

0 Kudos