Can loopback

https://docs.nvidia.com/jetson/archives/r35.3.1/DeveloperGuide/text/HR/ControllerAreaNetworkCan.html?#debug-methods

i have followed the same steps
jetpack 5.1.1
without shorting tx and rx I’m getting the same output

$ ip link set can0 type can bitrate 500000 loopback on
$ ip link set can0 up
$ candump can0 &
$ cansend can0 123#abcdabcd

can0 123 [4] AB CD AB CD
can0 123 [4] AB CD AB CD

Hi amb018753,

Are you using the devkit or custom board for Orin Nano?

It is expected because “loopback on” means internal loopback test and you don’t need to connect any cable externally.

[sudo] password for orin: 
orin@tegra-ubuntu:~$ sudo modprobe can-raw
orin@tegra-ubuntu:~$ sudo modprobe mttcan
orin@tegra-ubuntu:~$ sudo ip link set can0 down
orin@tegra-ubuntu:~$ sudo ip link set can0 up type can bitrate 500000 loopback on
orin@tegra-ubuntu:~$ sudo ip link set can0 up                                                                                                 
orin@tegra-ubuntu:~$ candump can0 &
[1] 3885
orin@tegra-ubuntu:~$ cansend can0 123#abcdabcd
orin@tegra-ubuntu:~$   can0  123   [4]  AB CD AB CD
  can0  123   [4]  AB CD AB CD

can this be validated for verifying CAN interface
" Short the Tx and Rx pins of the Jetson carrier board’s CAN0." this is not done externally

please let me know if its correct

You can not short CAN-TX/CAN-RX.
Please get a CAN transceiver to transform CAN-TX/CAN-RX to transform to CAN-H/CAN-L.

will can show loopback when we short TX and RX

Sorry that I’m not clear about what do you mean here?

CAN-TX and CAN-RX can not be shorted in any cases.

so
to verify can interface

  1. software loopback
    2.using transciever
    right ?

[ 1746.404074] can: controller area network core
[ 1746.404145] NET: Registered protocol family 29
[ 1746.405226] can: raw protocol
[ 1754.645325] CAN device driver interface
[ 1754.650356] Message RAM Configuration
| base addr |0x0c312000|
| sidfc_flssa |0x00000000|
| xidfc_flesa |0x00000040|
| rxf0c_f0sa |0x000000c0|
| rxf1c_f1sa |0x000009c0|
| rxbc_rbsa |0x000009c0|
| txefc_efsa |0x000009c0|
| txbc_tbsa |0x00000a40|
| tmc_tmsa |0x00000ec0|
| mram size |0x00001000|
[ 1754.651710] Release 3.2.3 from 09.06.2018
[ 1754.651991] net can0: mttcan device registered (regs=00000000f14d27ba, irq=11 3)
[ 1770.472403] mttcan c310000.mttcan can0: Bitrate set
[ 1770.472498] mttcan_controller_config: ctrlmode 0
[ 1770.472512] mttcan c310000.mttcan can0: Bitrate set
[ 1770.472600] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 1787.680893] mttcan c310000.mttcan can0: entered error warning state
[ 1787.687385] mttcan c310000.mttcan can0: entered error passive state
[ 1832.941150] mttcan c310000.mttcan can0: Bitrate set
[ 1832.941218] mttcan_controller_config: ctrlmode 1
[ 1832.941239] mttcan c310000.mttcan can0: Bitrate set
[ 1832.941295] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 1945.508455] mttcan c310000.mttcan can0: Bitrate set
[ 1945.508536] mttcan_controller_config: ctrlmode 1
[ 1945.508559] mttcan c310000.mttcan can0: Bitrate set
[ 1945.508823] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

why is it not showing loopback
image

For the loopback test from SW, you don’t need to connect any cable externally since it is internal loopback test.
You just need to specify “loopback on” when you are configuring CAN interface.

It seems your loopback test working before.
I don’t know why it would not work now.

i need to check loopback otherthan software loopback
what are the options i have
i have only can0 as node

is it possible to configure this can pin as gpio ?

Do you have 2 Orin Nano devkits and 2 CAN tranceivers?

You can pinmux those pin as GPIO if you don’t want to use them for CAN.

But you seem want to use CAN and you are verifying them…

I have but i need to validate in 1 device

There’s only one CAN interface by default on Orin Nano.
Maybe you would need the module like MCP2515 to get another CAN interface through SPI interface.
You may need to port MCP2515 driver and also verify SPI loopback test first.

I would suggest just using 2 devkits for the CAN verification.

what are the steps to be followed
can you guide me ?
either i need to validate those two pins as gpio pins

otherwise i need to validate those pins as CAN but otherthan loopback
can we short those 2 pins TX and RX and check loopback sameway as uart “but im not sure , since communication is through same line and uart has 2 line communication”

Please refer to Jetson Orin NX and Nano Series — Jetson Linux Developer Guide documentation (nvidia.com) to configure the pinmux.

For UART, you can short TX/RX for loopback test.

May I know what’s your current use case and the requirement?
You can using it as one function at the same time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.