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.

PROCESSOR-SDK-AM65X: CAN loopback test

Part Number: PROCESSOR-SDK-AM65X
Other Parts Discussed in Thread: AM6548

Hi Forum,

I am new to the AM6548 and have never used canutils.  Our custom board design is pretty similar to the AM6548 EVM board, and I am using Processor SDK for Linux 06.00.00.07.

Linux boots and I can login as root.  What I would like to do is connect simple jumpers with 100 ohm termination resistors to daisy chain can0 to can1.  I'd then like to use canutils to send some data from one interface and see that it's received by the other interface, and vice versa.

Can anyone provide a description of how to do this using the provided canutils in the SDK?  I confess that I know nothing about these utilities beyond some vague references to "cansend" and "candump".  I am also not a Linux expert, so I'm not entirely sure how to start sending from my login console and check for reception using the same console.  Do I have to put the sending into the background?

Any examples that you could provide would be extremely welcomed.  Thank you for your help; hoping my novice questions will help someone else in need.

Scott

  • Hi Forum,

    A follow-up with an experiment I tried.  I have a simple twisted pair cable between can0 and can1 + and - pins, with a 100 ohm termination at both ends.

    Using 'ifconfig -a', I saw that can0 and can1 both appeared to be loaded.  I had been concerned with whether I would need to use "modprobe can" or something similar, but it appears that the can drivers are loaded for both devices (dumb luck?).

    I then issued the following:

    ip link set can0 down

    ip link set can0 type can bitrate 500000

    ip link set can1 up

    ip link set can1 down

    ip link set can1 type can bitrate 500000

    ip link set can1 up

    I found a switch to log output from candump to a file, and executed this in the background:

    candump -l can1 &

    Then I issued a few different "cansend" commands:

    cansend can0 123#12345678

    cansend can0 01f#0102030405060708 

    etc...

    Then I switched back to the 'candump' command using 'fg', followed by Ctrl-C to end it.

    A .log file was created, and I used 'cat <name>.log' to view the data that was captured.  It worked!

    I'm not sure if the launching of candump in the background is the most effective way to do this, and I'm also not sure if there's a better way to generated a bunch of messages on the can bus that candump can collect, but it's a start.

    Comments and suggestions are very welcomed!

    Scott

  • Hi,

    Apologies for the late reply. It looks like you are are able to successfully loop back the interface.

    To answer your question the cantuils has a utility called cangen. You could also write a script just using cansend and candump. The source code for these utilities can be found here so if the utilities can be modified by you to meet your requirements. 

    Best Regards,

    Schuyler