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 and TI Processor SDK V 1: Can't open CAN device.



NOTE: I've updated this post with more info at the end of the post.

Hi -

I'm trying to get CAN working on an AM335x based board that is modeled on the AM335x GP EVM.

I have version 1.0.0.0 of the TI processor SDK for AM335x.

I've added pin mux settings to the am335x-evm.dts file for our pin mappings to the CAN device (I'll eventually create a dts file for our board, but for now just reusing the evm one) and I've rebuilt the device tree.

I'm following the instrtuctions on this page to configure the CAN: processors.wiki.ti.com/.../AM335X_DCAN_Driver_Guide

The issue is when I run the first canconfig command:
canconfig can1 bitrate 50000 ctrlmode triple-sampling on

I get a "can't find can device can1". If I try the alternative ip command shown on the page, I get the same results.

I've tried can0, dcan1, d_can1, and others.

I assume I'm missing some device file or something? Or, if my pin mux is not right, would the device file not be created?

When I do a find . -name '*can*' from /, I get the following output:

./etc/wpa_supplicant.conf

./etc/network/if-post-down.d/wpa-supplicant
./etc/network/if-pre-up.d/wpa-supplicant
./etc/dbus-1/system.d/dbus-wpa_supplicant.conf
./etc/default/volatiles/99_wpa_supplicant
./etc/p2p_supplicant.conf
./run/wpa_supplicant
./sys/bus/pci/rescan
./sys/kernel/debug/clk/virt_24000000_ck/sys_clkin_ck/dcan0_fck
./sys/kernel/debug/clk/virt_24000000_ck/sys_clkin_ck/dcan1_fck
./sys/module/scsi_mod/parameters/scan
./opt/ltp/testcases/bin/io_cancel01
./opt/ltp/bin/ltp-scanner
./var/lib/opkg/info/canutils.control
./var/lib/opkg/info/kernel-module-can-dev.control
./var/lib/opkg/info/kernel-module-c-can-platform.postrm
./var/lib/opkg/info/kernel-module-can-dev.list
./var/lib/opkg/info/kernel-module-can-gw.postrm
./var/lib/opkg/info/kernel-module-c-can.control
./var/lib/opkg/info/kernel-module-can-bcm.list
./var/lib/opkg/info/wpa-supplicant-passphrase.control
./var/lib/opkg/info/kernel-module-can-raw.control
./var/lib/opkg/info/wpa-supplicant-cli.list
./var/lib/opkg/info/kernel-module-can-raw.postinst
./var/lib/opkg/info/libsocketcan2.postinst
./var/lib/opkg/info/kernel-module-can-gw.list
./var/lib/opkg/info/canutils.list
./var/lib/opkg/info/kernel-module-can-raw.list
./var/lib/opkg/info/kernel-module-can-gw.postinst
./var/lib/opkg/info/kernel-module-can-raw.postrm
./var/lib/opkg/info/wpa-supplicant-cli.control
./var/lib/opkg/info/kernel-module-can-gw.control
./var/lib/opkg/info/wpa-supplicant-passphrase.list
./var/lib/opkg/info/kernel-module-can-bcm.postinst
./var/lib/opkg/info/kernel-module-c-can-platform.postinst
./var/lib/opkg/info/wpa-supplicant-wl18xx.list
./var/lib/opkg/info/kernel-module-can-bcm.postrm
./var/lib/opkg/info/kernel-module-can-bcm.control
./var/lib/opkg/info/kernel-module-can.list
./var/lib/opkg/info/kernel-module-c-can-platform.list
./var/lib/opkg/info/kernel-module-c-can-platform.control
./var/lib/opkg/info/kernel-module-can.postrm
./var/lib/opkg/info/libsocketcan2.list
./var/lib/opkg/info/wpa-supplicant-wl18xx.control
./var/lib/opkg/info/kernel-module-can-dev.postinst
./var/lib/opkg/info/kernel-module-c-can.postinst
./var/lib/opkg/info/kernel-module-c-can.list
./var/lib/opkg/info/kernel-module-c-can.postrm
./var/lib/opkg/info/kernel-module-can.control
./var/lib/opkg/info/kernel-module-can.postinst
./var/lib/opkg/info/libsocketcan2.control
./var/lib/opkg/info/kernel-module-can-dev.postrm
./proc/sys/vm/scan_unevictable_pages
./proc/device-tree/matrix_keypad@0/col-scan-delay-us
./proc/device-tree/ocp/can@481d0000
./proc/device-tree/ocp/can@481cc000
./proc/device-tree/ocp/scrm@44e10000/clocks/dcan1_fck
./proc/device-tree/ocp/scrm@44e10000/clocks/dcan0_fck
./proc/device-tree/pinmux@44e10800/dcan1_pins_default
./proc/device-tree/aliases/d_can1
./proc/device-tree/aliases/d_can0
./usr/share/terminfo/c/colorscan
./usr/share/terminfo/s/scanset
./usr/share/terminfo/d/decansi
./usr/share/terminfo/p/pcansi-m
./usr/share/terminfo/p/pcansi33m
./usr/share/terminfo/p/pcansi-25-m
./usr/share/terminfo/p/pcansi25m
./usr/share/terminfo/p/pcansi
./usr/share/terminfo/p/pcansi-43
./usr/share/terminfo/p/pcansi-33-m
./usr/share/terminfo/p/pcansi25
./usr/share/terminfo/p/pcansi43
./usr/share/terminfo/p/pcansi-43-m
./usr/share/terminfo/p/pcansi33
./usr/share/terminfo/p/pcansi-25
./usr/share/terminfo/p/pcansi-mono
./usr/share/terminfo/p/pcansi-33
./usr/share/qt5/examples/script/context2d/qcontext2dcanvas.cpp
./usr/share/qt5/examples/script/context2d/qcontext2dcanvas.h
./usr/share/qt5/examples/multimedia/declarative-camera/images/camera_white_balance_incandescent.png
./usr/share/qt5/examples/quick/particles/images/candle.png
./usr/share/qt5/examples/quick/canvas
./usr/share/qt5/examples/quick/canvas/canvas.qml
./usr/share/qt5/examples/quick/canvas/canvas.qrc
./usr/share/qt5/examples/quick/canvas/canvas
./usr/share/qt5/examples/quick/canvas/canvas.pro
./usr/share/qt5/examples/widgets/widgets/tablet/tabletcanvas.h
./usr/share/qt5/examples/widgets/widgets/tablet/tabletcanvas.cpp
./usr/share/autoconf/autoscan
./usr/share/autoconf/autoscan/autoscan.list
./usr/share/autoconf/autoconf/autoscan.m4
./usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service
./usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service
./usr/share/wl18xx/wpa_supplicant.conf
./usr/share/wl18xx/p2p_supplicant.conf
./usr/include/linux/can.h
./usr/include/linux/can
./usr/sbin/canconfig
./usr/sbin/wpa_supplicant
./usr/bin/autoscan
./usr/bin/canecho
./usr/bin/qt5/qmlimportscanner
./usr/bin/dvbv5-scan
./usr/bin/cansend
./usr/bin/cansequence
./usr/bin/candump
./usr/lib/perl/5.14.3/auto/POSIX/sscanf.al
./usr/lib/perl/5.14.3/auto/POSIX/scanf.al
./usr/lib/perl/5.14.3/auto/POSIX/fscanf.al
./usr/lib/libsocketcan.so.2
./usr/lib/libsocketcan.so.2.2.0
./usr/lib/gstreamer/gstreamer-0.10/gst-plugin-scanner
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/c_can
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/c_can/c_can.ko
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/c_can/c_can_platform.ko
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/can-dev.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-bcm.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-gw.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-raw.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can.ko

Am I missing a device file?

UPDATE!!!!!!!!!!!!

Okay, I think the CAN device driver is a module, and therefore wasn't installed. I see these CAN releated modules on my system.

./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/c_can/c_can.ko
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/c_can/c_can_platform.ko
./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/can-dev.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-bcm.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-gw.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can-raw.ko
./lib/modules/3.14.26-g2489c02/kernel/net/can/can.ko

I'm not sure which ones I need. I did do an insmod on one of them:

./lib/modules/3.14.26-g2489c02/kernel/drivers/net/can/can-dev.ko

Am I loading the right one? Do I need more than one? And after loading, do I need to do some kind of mknod command?

Thanks!

Thanks,

Jeff

  • Hi Jeff,

    Please make sure you have followed the steps described here when building your kernel:

    http://processors.wiki.ti.com/index.php/Linux_Core_DCAN_User%27s_Guide#Linux_Driver_Configuration 

  • Thanks for the response, Biser.

    So, my menuconfig was showing the CAN devices were modules (M) and NOT built into the kernel (*). Thus, I went and hit 'y' on all the related devices as shown on the webpage you linked in your post. I saved the config as the default name .config. I then exited menuconfig and reopened it, to verify that the changes were saved - they were.

    I then cleaned and rebuilt the kernel.

    As a sanity check, after building the kernel, I went back into menuconfig, and all the items I had changed to * were back to M.

    Three questions:
    1. Why are the CAN devices reverting from built-in (*) to modules (M) in menuconfig, and how do I fix this? Do I need to save the config to something other than .config? Is there an am335x EVM config that I have to overwrite?

    2. Once the changes to make menuconfig stick (i.e. all the CAN devices show as * intead of M), and once the kernel is built and booted, how do I verify that all those device are actually built into the kernel?

    3. I'm assuming that using the CAN devices as kernel modules would have worked fine if I wanted to do insmod and mknod on the various devices. Since they're now built in, will all the necessary device files (like those created by mknod) have been created for me? If they are created, where in the file system can I find them so that I can verify that they're there?

    Thanks!

  • Deleted by user for clarity. Unneeded debug info.

  • Deleted by user for clarity. Unneeded debug info.

  • Deleted by user for clarity. Unneeded debug info.

  • Deleted by user for clarity. Unneeded debug info.

  • Hi Jeff,

    Jeff Fuller said:
    I then cleaned and rebuilt the kernel.

     

    Cleaning will wipe out all configurations done by menuconfig & will replace them with the singlecore-omap2plus_defconfig settings.  Building from ti sdk root directory will do the same. 

    Here is what I've done in order to get the userspace commands to work. 

    1. Do the pinmux configurations for dcan0 as per your use case. 

    2. Add 

    &dcan0 {
                  status = "okay";
                  pinctrl-names = "default";
                  pinctrl-0 = <&dcan0_pins>;
    };

    in your DTS file. 

    3. Execute:

    cd ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ export ARCH=arm

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ export PATH=$PATH:~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ export CROSS_COMPILE=arm-linux-gnueabihf-

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ make distclean

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ make singlecore-omap2plus_defconfig 

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ make menuconfig

    Hit <y> on all DCAN configs shown in the wiki & save them, in order to have CAN utilities built-in the kernel. 

    ~/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02$ make -j4

    This will build your kernel with the CAN drivers. 

    When you boot your board you should see the can in /proc/iomem and should be able to perform the user space commands described in http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide 

    Best Regards, 

    Yordan

  • Thank you Yordan!

    That did it.

    Just one question: in order to save my config generated by make menuconfig, I should overwrite the singlecore-omap2plus_defconfig with my config, correct?

    That way, cleaning won't cause my config to be lost. (In the furture, I'll create a config for our board, for both U-Boot and the Kernel, but time constraints have me just modifying the AM335x GP EVM configuration for now).

    Thanks,

    Jeff

  • Hi Jeff,

    Jeff Fuller said:
    Just one question: in order to save my config generated by make menuconfig, I should overwrite the singlecore-omap2plus_defconfig with my config, correct?

     

    Correct. 

    Another approach is to do the settings directly in the defconfig file. 

    Best Regards, 

    Yordan