Problem setting UART baud rate in MKL36Z256VLH4

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

Problem setting UART baud rate in MKL36Z256VLH4

Jump to solution
1,089 Views
aniketc
Contributor II

Hi,

We are using MKL36Z256VLH4 in one of our product. We need to use the UART functionality on pin PTE22 and PTE23 i.e.UART2_TX and UART2_RX with baud rate 115200.


While selecting value for SBR12:SBR0 in UARTx_BDH and UARTx_BDL, we used formula BaudRate = UART Module Clock/(SBR 12:0 X 16). As Bus clock is used as UART Module Clock, we have selected 4MHz Internal reference clock as Bus clock.

So while selecting SBR12:SBR0 with bus clock 4Mhz and required UART baud rate 115200, the value comes out to be 2.170 . So, rounding of the value SBR12:SBR0 to 2, the UART baudrate generated is 125000. We can observe data at 125000 bps, but not at 115200.

What can be done to achive baud rate of 115200? Am I missing something? We have used a microcontroller in other product, from K30-series which had BRFA register for fine adjustment of Baudrate, do we need to do any such settings for MKL36Z256VLH4 ?

Thanks in Advance.

Regards,
Aniket

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
882 Views
mjbcswitzerland
Specialist V

Hi Anitek

The UART in the KL36 doesn't have a fractional divider and so you need to supply a clock that is suitable for the baud rate that you require.

4MHz MCGIRCLK is limited due to its low frequency and not suitable for 115200 Baud.
You can however use MCGFLLCLK instead and achieve 115'318 (typical) if you use the internal 32kHz IRC and FLL set to 732 (24MHz).

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis KL43:
- http://www.utasker.com/kinetis/FRDM-KL43Z.html
- http://www.utasker.com/kinetis/TWR-KL43Z48M.html

SLCD: http://www.utasker.com/docs/uTasker/uTasker_SLCD.pdf


Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

View solution in original post

0 Kudos
Reply
1 Reply
883 Views
mjbcswitzerland
Specialist V

Hi Anitek

The UART in the KL36 doesn't have a fractional divider and so you need to supply a clock that is suitable for the baud rate that you require.

4MHz MCGIRCLK is limited due to its low frequency and not suitable for 115200 Baud.
You can however use MCGFLLCLK instead and achieve 115'318 (typical) if you use the internal 32kHz IRC and FLL set to 732 (24MHz).

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis KL43:
- http://www.utasker.com/kinetis/FRDM-KL43Z.html
- http://www.utasker.com/kinetis/TWR-KL43Z48M.html

SLCD: http://www.utasker.com/docs/uTasker/uTasker_SLCD.pdf


Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

0 Kudos
Reply