This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x can回环测试bing出错?



can的移植使用过程如下:

芯片:am335x

linux:   Linux 3.2.0+ #16 Wed Jan 6 17:51:54 CST 2016 armv7l GNU/Linux

1.参考 配置内核 AM335X DCAN Driver Guide - Texas Instruments Wiki.htm

2.板级文件添加如下:

(1)

static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {

{dcan_init, DEV_ON_BASEBOARD, PROFILE_ALL},

}

(2)

static void dcan_init(int evm_id, int profile)
{
(void)evm_id;
(void)profile;

setup_pin_mux(d_can_dvt0_pin_mux);
am33xx_d_can_init(0);

setup_pin_mux(d_can_dvt1_pin_mux);
am33xx_d_can_init(1);
}

(3)

static struct pinmux_config d_can_dvt0_pin_mux[] = {
{"uart1_ctsn.d_can0_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
{"uart1_rtsn.d_can0_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
{NULL, 0},
};

static struct pinmux_config d_can_dvt1_pin_mux[] = {
{"uart1_rxd.d_can1_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
{"uart1_txd.d_can1_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
{NULL, 0},
};

3. 把对应的uart1 与 i2c2 注释掉!避免跟can管教冲突!

4. 交叉编译

libsocketcan-0.0.10

canutils4.0.6

5. 测试:

root@hi-target:/mnt/platform/can# ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:52

can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:55

6.错误情况:

root@hi-target:/mnt/platform/can# ./canconfig can0 bitrate 100000 ctrlmode loop
back on
can0 bitrate: 100000, sample-point: 0.875
can0 ctrlmode: loopback[ON], listen-only[OFF], tripple-sampling[OFF],one-shot[OFF], berr-reporting[OFF]
root@hi-target:/mnt/platform/can# ./canconfig can0 start
can0 state: ERROR-ACTIVE
root@hi-target:/mnt/platform/can# ./cansend can0 --identifier=0x123 0x12
interface = can0, family = 29, type = 3, proto = 1
bind: Invalid argument

root@hi-target:/mnt/platform/can# ./candump can0
interface = can0, family = 29, type = 3, proto = 1
bind: Invalid argument

=================================================

为什么 会出现bind: Invalid argument 》?????  另外can0 state: ERROR-ACTIVE 是不是表示启动不成功can????

这个是回环测试,用两个am335x的can连起来,使用 tripple-sampling 模式,也是这样的情况,希望TI工程师看看是啥情况?

=======================================================================================

1.现在的dcan已经能正常运行了!

现在想把j1939的can协议补丁上去,请问TI工程师,

 insmod  can-j1939.ko  

之后,DCAN跟这个 can-j1939.ko  冲突么? 

另外有相关支持j1939的资料么?