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

2,054件の閲覧回数
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,828件の閲覧回数
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,828件の閲覧回数
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,828件の閲覧回数
ErichStyger
Specialist I

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,828件の閲覧回数
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,828件の閲覧回数
ErichStyger
Specialist I

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 件の賞賛
返信