All Boards FlexCAN

Document created by jesseg Employee on Aug 6, 2012Last modified by ebiz_ws_prod on Dec 13, 2017
Version 8Show Document
  • View in full screen mode

Freescale LTIB provides only the low level FlexCAN driver, so you can add Canutils and Libsocketcan developed by Pengutronix to have some more functions available on user space and some test and monitoring applications.


Adding Flexcan driver support on Kernel


On kernel menuconfig, add the following items:

[*] Networking support  --->
    <*>  CAN bus subsystem support  --->
        <*>  Raw CAN Protocol (raw access with CAN-ID filtering)
        <*>  Broadcast Manager CAN Protocol (with content filtering)
    CAN Device Drivers  --->
        <*> Virtual Local CAN Interface (vcan)
        [*] CAN devices debugging messages
        <*> Freescale FlexCAN


Adding Canutils and Libsocketcan Packages on LTIB


Download the libsocketcan-0.0.8.tar.bz2 and canutils-4.0.6.tar.bz2 source codes from the links below and save them on your PC at /opt/freescale/pkgs

On LTIB directory, create the spec file folders:

cd <ltib directory>/dist/lfs-5.1
mkdir canutils
mkdir libsocketcan


Download the following spec files, unpack them on their respective folders:

Can_specs.tar.gz ( attached below )

Now, on ltib directory, unpack, build and deploy them:

cd <ltib directory>
./ltib -p libsocketcan.spec -f
./ltib -p canutils.spec -f


Testing the FlexCAN network

To test the Flexcan network, first set the bitrate and after enable the can port:

canconfig can0 bitrate 125000
ifconfig can0 up                                        


Now it's possible to test the network connecting two boards:

On board 1:

cansend can0 -i0x100 11 22 33 44


On board 2:

canecho can0 -v


Board 2 will show the data coming from board 1.

Original Attachment has been moved to: Can_specs.tar.gz

3 people found this helpful