Tool/software: Linux
Hi,
i have a problem with dcan module, the problem is that the Data can only be sent successfully in loopback mode.
No data can be received except data that is self-sending in loop mode.
the following code is the pin configuration of device tree.
dcan1_pins_ds: pinmux_dcan1_pins_ds { pinctrl-single,pins = < DRA7XX_CORE_IOPAD(0x37d4, PIN_INPUT | MUX_MODE15) /* (Errata i893) dcan1_rx.dcan1_rx */ DRA7XX_CORE_IOPAD(0x37d0, PIN_OUTPUT | MUX_MODE0) /* dcan1_tx.dcan1_tx */ >; }; dcan2_pins_ds: pinmux_dcan2_pins_ds { pinctrl-single,pins = < DRA7XX_CORE_IOPAD(0x37bc, PIN_INPUT | MUX_MODE15) /* (Errata i893) spi1_cs3.dcan2_rx */ DRA7XX_CORE_IOPAD(0x37b8, PIN_OUTPUT | MUX_MODE4) /* spi1_cs2.dcan2_tx */ >; };
following log tells what i did>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@dra7xx-evm:~# ./setup_can_bus.sh 0 [ 103.055836] c_can_platform 4ae3c000.can can0: setting BTR=0504 BRPE=0000 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 500000 sample-point 0.875 tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1 c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1 clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 root@dra7xx-evm:~# root@dra7xx-evm:~# ifconfig 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:87 eth0 Link encap:Ethernet HWaddr 38:0B:3C:40:EA:44 UP BROADCAST MULTICAST MTU:1500 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:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:84 eth1 Link encap:Ethernet HWaddr 38:0B:3C:40:EA:45 UP BROADCAST MULTICAST MTU:1500 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:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1%763612/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:162 errors:0 dropped:0 overruns:0 frame:0 TX packets:162 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12300 (12.0 KiB) TX bytes:12300 (12.0 KiB) root@dra7xx-evm:~# cansend can0 123#1122334455 root@dra7xx-evm:~# ifconfig 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:87 eth0 Link encap:Ethernet HWaddr 38:0B:3C:40:EA:44 UP BROADCAST MULTICAST MTU:1500 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:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:84 eth1 Link encap:Ethernet HWaddr 38:0B:3C:40:EA:45 UP BROADCAST MULTICAST MTU:1500 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:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1%763612/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:162 errors:0 dropped:0 overruns:0 frame:0 TX packets:162 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12300 (12.0 KiB) TX bytes:12300 (12.0 KiB) root@dra7xx-evm:~# cat setup_can_bus.sh #!/bin/sh #modprobe can #modprobe can-dev #modprobe can-raw #modprobe mcp251x ip link set can"$1" down ip link set can"$1" type can bitrate 500000 ip link set can"$1" up ip -details link show can0 root@dra7xx-evm:~# ip -details link show can0 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 500000 sample-point 0.875 tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1 c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1 clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 root@dra7xx-evm:~# can can-calc-bit-timing candump cangen canlogserver cansend canbusload canfdtest cangw canplayer cansniffer root@dra7xx-evm:~# can can-calc-bit-timing candump cangen canlogserver cansend canbusload canfdtest cangw canplayer cansniffer root@dra7xx-evm:~# can ip -details link show can0 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 500000 sample-point 0.875 tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1 c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1 clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
==============================================================
I also noticed the comment of Errata code in device tree. If it causes the module to not work properly. what should i do? or where can I refer to sample code?
Thank you so much.