Incorrecte baudrate in FRDM-K64F flexcan example

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

Incorrecte baudrate in FRDM-K64F flexcan example

跳至解决方案
1,196 次查看
johanwallstrom
Contributor I

Hi!

 

I'm trying to run the flexcan_loopback example in the SDK 2.0 IAR for FRDM-K64F.

 

I changed the UART instance to UART4, and changed the MUX for the correct pins, and activated the clocks for PORTE.
Despite that, no changes from standard. But the problem is, the output baudrate is half the specified.

 

In BOARD_InitDebugConsole, uartClkSrcFreq is set to 120MHz. I don't know if that is correct.

 

Any ideas? Is it system clock that is wrong or only the uart baudrate?

标签 (1)
标记 (3)
0 项奖励
1 解答
812 次查看
isaacavila
NXP Employee
NXP Employee

Hello Johan,

In K64's reference manual http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf , there is a section called Clock distribution (chapter 5), in which, it specifies different clock sources for all available modules in K64. In section 5.7.10 UART clocking section, it expresses:

" UART0 and UART1 modules operate from the core/system clock, which provides higher performance level for these modules. All other UART modules operate from the bus clock."

And as MCU is operating in PEE modue, System clock is configured to 120MHz while Bus clock is set to 60MHz. So, source clock value is the problem you are facing.

You can substitute the definition:

#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()

by:

#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetBusClkFreq()

Then recompile the project and it should be working well.

I hope this can help you!

Regards,

Isaac

在原帖中查看解决方案

2 回复数
812 次查看
johanwallstrom
Contributor I

Hello,


that works perfectly!

Thank you so much!

best regards
Johan

0 项奖励
813 次查看
isaacavila
NXP Employee
NXP Employee

Hello Johan,

In K64's reference manual http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf , there is a section called Clock distribution (chapter 5), in which, it specifies different clock sources for all available modules in K64. In section 5.7.10 UART clocking section, it expresses:

" UART0 and UART1 modules operate from the core/system clock, which provides higher performance level for these modules. All other UART modules operate from the bus clock."

And as MCU is operating in PEE modue, System clock is configured to 120MHz while Bus clock is set to 60MHz. So, source clock value is the problem you are facing.

You can substitute the definition:

#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()

by:

#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetBusClkFreq()

Then recompile the project and it should be working well.

I hope this can help you!

Regards,

Isaac