How to configure the Socket CAN br_clksrc from bus to clk ?

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

How to configure the Socket CAN br_clksrc from bus to clk ?

ソリューションへジャンプ
3,100件の閲覧回数
gurumoorthirasi
Contributor IV

Dear All,

How to configure the Socket CAN br_clksrc from bus to clk ?

i tried the below command

ifconfig can0 down

echo 0 > /sys/devices/platform/Flex.can0/br_clksrc

cat /sys/devices/platform/Flex.can0/br_clksrc

bus

it is in bus mode only. how to change it to clk.

This is high priority !!!

Regards,

Guru

ラベル(2)
1 解決策
2,854件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi Juan ,

I think Guru already has the answer to this.

We had to change the default value of br_clksrc to 0 in the dev.c file found in linux/drivers/net/can/flexcan/ function flexca_device_default.

And take the "osc24m" instead of "ckih" in the flexcan_update_bitrate fucntion.

After that we could change the br_propseg, br_pseg1 and br_pseg2 to get the 1Mbps.

Best Regards,

Alejandro

元の投稿で解決策を見る

6 返答(返信)
2,854件の閲覧回数
juangutierrez
NXP Employee
NXP Employee

Which BSP or kernel are you using. I can not found sucha a clck br_clksrc.

If this is a custom change?

0 件の賞賛
返信
2,854件の閲覧回数
gurumoorthirasi
Contributor IV

hi,

I am using the linux kernel 2.6.31 downloaded from freescale imx25 products downloads page.

you can found that only flexcan driver has been loaded .

Regards,

Guru

2,854件の閲覧回数
juangutierrez
NXP Employee
NXP Employee

Can you try

echo "osc" > /sys/devices/platform/Flex.can0/br_clksrc

0 件の賞賛
返信
2,854件の閲覧回数
gurumoorthirasi
Contributor IV

Hi i tried that also it wont work.

Is anything specially need to change in FLEXCAN driver file for OSC clock?

0 件の賞賛
返信
2,854件の閲覧回数
juangutierrez
NXP Employee
NXP Employee

Well if you check the flexcan_set_attr function at drivers/net/can/flexcan/dev.c

if (attr_id == FLEXCAN_ATTR_BR_CLKSRC) {

                if (!strncasecmp(buf, "bus", 3))

                        flexcan->br_clksrc = 1;

                else if (!strncasecmp(buf, "osc", 3))

                        flexcan->br_clksrc = 0;

                goto set_finish;

        }

This function should be called when writing in the br_clksrc device (echo "osc" > /sys/devices/platform/Flex.can0/br_clksrc)

In case writing "osc" then flexcan->br_clksrc = 0

I think you can add some logs/traces (with pr_err or pr_info) to see if really reaching this part of the code

The default/initial value for br_clksrc is set to 1 at arch/arm/mach-mx25/mx25_3stack.c in

struct flexcan_platform_data flexcan_data[] = {

...

.br_clksrc = 1,

..

You can try forcing this to 0

2,855件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi Juan ,

I think Guru already has the answer to this.

We had to change the default value of br_clksrc to 0 in the dev.c file found in linux/drivers/net/can/flexcan/ function flexca_device_default.

And take the "osc24m" instead of "ckih" in the flexcan_update_bitrate fucntion.

After that we could change the br_propseg, br_pseg1 and br_pseg2 to get the 1Mbps.

Best Regards,

Alejandro