What clock does the K64F run at for determining flexcan timing?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What clock does the K64F run at for determining flexcan timing?

ソリューションへジャンプ
775件の閲覧回数
ironsean
Contributor V

Hello,

 

I'm trying to implement Flexcan on a K64F board with a shield board we've created with a CAN chip on it. I had it working in MQX 4.1.1 with the kflexcan header, but the new peripheral driver seems a lot more barebones. For starters, there's no automated calculation of timing values based on an input baud rate, so I'm trying to figure out how to set it up.

 

There's an example in the TowerK64f board which should be very similar, but I see there it has timings for 48MHz and 60MHz but I don't know what a K64F is running by default.

 

I'm on KDS 3.0 and KSDK 1.2. Not using processor expert of changing the clock timing specifically.

 

Sean

ラベル(1)
1 解決策
385件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Sean,

Alice is correct that the default clocking of the Kinetis device is using FEI and therefore the core will operate at ~21.9xxxMHz or so.

But if you are running the KDS_3.0.0/KSDK_1.2.0 flexcan demo:

C:\Freescale\KSDK_1.2.0\examples\twrk64f120m\driver_examples\flexcan\flexcan_loopback\kds

Then the clocking code is setting up the core to operate at 120MHz, the peripheral bus at 60MHz, external bus at 30MHz, and flash interface at 20MHz.

This is seen in the board.c BOARD_ClockInit() function that then calls the CLOCK_SYS_SetConfiguration() to set the clocks accordingly.  This function in fsl_clock_MK64F12.c .

If you set into that function call you will see the clock dividers set up as follows:

    /* Set outdiv for safe output clock frequency. */

    CLOCK_HAL_SetOutDiv(SIM, 0U, 1U, 2U, 4U);  //DES 0=div by 1, 1=div by 2, 2=div by 3, 4=div by 5

FlexCAN module uses the peripheral bus that is clocked at 60MHz.

Regards,

David

元の投稿で解決策を見る

3 返答(返信)
386件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Sean,

Alice is correct that the default clocking of the Kinetis device is using FEI and therefore the core will operate at ~21.9xxxMHz or so.

But if you are running the KDS_3.0.0/KSDK_1.2.0 flexcan demo:

C:\Freescale\KSDK_1.2.0\examples\twrk64f120m\driver_examples\flexcan\flexcan_loopback\kds

Then the clocking code is setting up the core to operate at 120MHz, the peripheral bus at 60MHz, external bus at 30MHz, and flash interface at 20MHz.

This is seen in the board.c BOARD_ClockInit() function that then calls the CLOCK_SYS_SetConfiguration() to set the clocks accordingly.  This function in fsl_clock_MK64F12.c .

If you set into that function call you will see the clock dividers set up as follows:

    /* Set outdiv for safe output clock frequency. */

    CLOCK_HAL_SetOutDiv(SIM, 0U, 1U, 2U, 4U);  //DES 0=div by 1, 1=div by 2, 2=div by 3, 4=div by 5

FlexCAN module uses the peripheral bus that is clocked at 60MHz.

Regards,

David

385件の閲覧回数
ironsean
Contributor V

Thank you, that is fantastic information and helps me understand exactly what I need to know how this is set up, or set it up myself.

I also found that the MQX 4.2 release still has the kflexcan drivers which include auto-calculation of baud rates as an alternate option for anyone searching who finds this.

Sean

0 件の賞賛
385件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Sean,

The default mcu clock mode is FEI, you can refer to here(from the K64 reference manual ) :

pastedImage_1.png

And the Flexcan clock , we can refer to here :

pastedImage_0.png

pastedImage_1.png

then , about the "OSCERCLK" and "Bus clock" , please see here :

pastedImage_2.png


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛