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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,596 次查看
jricaurtepino
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é

标签 (1)
标记 (2)
5 回复数

1,370 次查看
mjbcswitzerland
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]

1,370 次查看
anitadavis19898
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 项奖励

1,370 次查看
ErichStyger
Senior Contributor V

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 项奖励

1,370 次查看
jricaurtepino
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 项奖励

1,370 次查看
ErichStyger
Senior Contributor V

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 项奖励