imxrt 1064 CAN-FD fast baud rate

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

imxrt 1064 CAN-FD fast baud rate

1,525 Views
johannzimmerman
Contributor II

Hi,

The flexcan_interrupt example:

have problem with CAN-FD initialization 4000kbd for the data phase.

It fails in the line
assert (priDiv <= sourceClock_Hz);

priDiv = 40Mhz and sourceClock_Hz = 20Mhz


MCUXpresso config tool v6 shows the Fast baud rate 4000000 without error message.

How can I generate higher fast baud rate?

Are there any examples?

Regards,

Johann

Tags (1)
0 Kudos
7 Replies

1,333 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Johann Zimmermann

This is because you are using the clock source configuration of the example, which is

#define EXAMPLE_CAN_CLK_FREQ ((CLOCK_GetFreq(kCLOCK_Usb1PllClk)/6)/(FLEXCAN_CLOCK_SOURCE_DIVIDER + 1U))

With FLEXCAN_CLOCK_SOURCE_DIVIDER (3U), you have a clock source of 20M, which doesn't give you an integer divider with the quantum config in order to have the 4M that you want in the baud rate.

You can change the Quantum configuration which is located above those definitions, or you can change the FLEXCAN_CLOCK_SOURCE_DIVIDER (1U), so you will have a clock source of 40M, giving the correct divider for the 4M that you want.


Have a great day,
TIC

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

1,333 Views
johannzimmerman
Contributor II

Thanks for the answer.
With FLEXCAN_CLOCK_SOURCE_DIVIDER (1U) the baud rate of 4000000 works fine.

Now I am facing the next hurdle:
I need all the CAN-IDs that come on the CAN bus.
How can I disable the filtering of the CAN messages to get them all?
Thank you in advance.

0 Kudos

1,333 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Johann

In the example code you can find:

/* Set Rx Masking mechanism. */
    FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, FLEXCAN_RX_MB_STD_MASK(rxIdentifier, 0, 0));

    /* Setup Rx Message Buffer. */
    mbConfig.format = kFLEXCAN_FrameFormatStandard;
    mbConfig.type   = kFLEXCAN_FrameTypeData;
    mbConfig.id     = FLEXCAN_ID_STD(rxIdentifier);
#if (defined(USE_CANFD) && USE_CANFD)
    FLEXCAN_SetFDRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &mbConfig, true);

If you change the rxIdentifier to FFs, your masking will receive all the message of all the IDs

You can also check the "Matching process" section of the reference manual, in the FlexCan chapter.

Regards

Jorge Alcala

0 Kudos

1,333 Views
johannzimmerman
Contributor II

Hi Jorg,

Thank you for your prompt reply.
If I change the rxIdentifier to 0xFFFFFFFF
then only the CAN-IF 0x7FF will receive all other ignored.
Regardless of whether the ID 0x7FF is sent as CAN-STD or CAN-FD - both are received.

Regards

Johann

0 Kudos

1,333 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Johann Zimmermann

If you use 0xFFF in the Global mask it will consider all the bits of the IDs that are received, if you clear all the register of the global mask has the effect of disabling the ID filer. For the individual mask, you need to clear the bits to correspond a set a "don't care". Please use both masks as 0's so the global mask is disabled and the individual mask is don't care.

Regards

Jorge Alcala

0 Kudos

1,333 Views
johannzimmerman
Contributor II

Hi Jorge Alcala,

If the register RXMGMASK is set to 0 all CAN messages are received.
So far so good, but then I have another problem: when sending a CAN message,
I had unexpectedly received an IRQ again to the recipients
and although the last thing was received.

Set the bit CAN_MCR_SRXDIS_MASK in the MCR register fixed the problem.
The bit CAN_MCR_SRXDIS_MASK is not supported in the SDK.
Is there another way in the SDK to disable the self-reception of CAN-Messages with global mask 0?

Regards
Johann Zimmermann

0 Kudos

1,333 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Johann Zimmermann

No, unfortunately, as you mentioned, the self reception disable bit has not been implemented in an API, so you need to set it with direct access to the register field. Sorry for the inconveniences that this may cause you.

Regards

0 Kudos