AnsweredAssumed Answered

i.MX6 flexcan does not produce accurate bitrate

Question asked by Hamidreza Hosseini on Jul 27, 2014
Latest reply on Jul 29, 2014 by igorpadykov

Hi everybody;

 

I am using i.MX6D, and linux kernel 3.0.35.

I want to utilize flexcan.1, In transmit, it is OK, but in receive, it drops packets occasionally.

I checked it with a counter and noticed that although short packets have been dropped, but packets with 7  or 8 bytes long are dropped frequently.

 

when I set bitrate to 800K with canconfig (also ip tool), it says:

 

flexcan imx6q-flexcan.1: bitrate error 1.3%

can1 bitrate: 789473, sample-point: 0.789

flexcan imx6q-flexcan.1: writing ctrl=0x01332006

 

i checked flexcan driver and in probe clock set as follows:

clk = clk_get(&pdev->dev, NULL);

 

and in clock.c from arch/arm/mach-mx6, can root clock defined as below:

static struct clk can_clk_root = {

         __INIT_CLK_DEBUG(can_clk_root)

        .parent = &pll3_60M,

        .set_rate = _clk_can_root_set_rate,

        .get_rate = _clk_can_root_get_rate,

        .round_rate = _clk_can_root_round_rate,

};

 

so it sholud use 24MHz for generating bitrate which must be accurate for 800K. wright?

why it is happening?

 

thanks in advance

Outcomes