...
Provide a Linux demo project combining all the requirements in this project.
Rationale: Needed to let Customer integrate results of this project into target embedded application.
Implementation: Section: "Design: Demo project".
Test: Section: "Test Plan: Demo Project".
Develop Linux CAN device driver for the i.MX RT CAN controller.
Rationale: Explicit Customer requirement.
Implementation: Section: "Design: Linux CAN Device Driver".
Test: Section: "Test Plan: Linux CAN Driver".
Port CANSocket to the Linux i.MX RT BSP.
Rationale: Explicit Customer requirement.
Implementation: Section: "Design: CANSocket".
Test: Section: "Test Plan: CANSocket".
Validate successful execution of the test suite from the SocketCAN package.
Rationale: Explicit Customer requirement.
Implementation: Section: "Design: CANSocket Test Suite".
Test: Section: "Test Plan: CANSocket Test Suite".
2.2. Detailed Non-Requirements
...
Download the files listed in Section: "Downloadable Files" to the top of the Linux i.MX RT installation.
Install the BSP, as per the respective "Installing and activating cross development environment" document in the "Software" section on the Emcraft site.
From the top of the Linux installation, activate the Linux cross-compile environment by running:
Code Block $ . ./ACTIVATE.sh
Install U-Boot to the target board.
for the IMXRT10XX-EVK boards as per Installing U-Boot to the NXP i.MX RT10XX EVK Board
for the IMXRT1170-EVK boards as per https://emcraft.com/imxrt1170-evk-board/installing-uboot-to-imxrt1170-evk-board
From the top of the BSP installation, go to the Linux kernel tree and install the kernel patch, eg:
Code Block $ cd linux/ $ patch -p1 < ../../linux-flexcan.patch
From the top of the Linux installation, go to the
projects
sub-directory, and patch therootfs
project:Code Block $ cd projects/ $ patch -p1 < ../../projects-flexcan.patch
On the Linux PC intended for execution of the CANsocket test suite, ensure that the following software is installed (Emcraft used Linux PC running the
Fedora 16
(3.1.0-7.fc16.i686.PAE) installation; the other Linux distributives should work too, but may require some additional steps like compilation and installation of the CAN framework kernel modules):Install
can-utils
package on the Linux PC (commands below are for a Fedora host):Code Block $ sudo yum install can-utils ... $
Install and build
can-tests
on the Linux PC:Code Block $ cd ~ $ git clone https://github.com/linux-can/can-tests.git $ cd can-tests $ make $ sudo DESTDIR=/usr PREFIX= make install
Load the CAN kernel modules on the Linux PC:
Code Block $ sudo modprobe can $ sudo modprobe can-raw $ sudo modprobe slcan
Connect the VSCOM USB-CAN adapter to the Linux PC and configure it as follows:
Get the VSCOM USB-CAN serial device name (in the example below it is
ttyUSB0
):Code Block $ dmesg | tail [77641.738206] usbcore: registered new interface driver ftdi_sio [77641.739086] usbserial: USB Serial support registered for FTDI USB Serial Device [77641.747063] ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected [77641.747348] usb 1-2: Detected FT232R [77641.781982] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0 [78603.073189] can: controller area network core [78603.073360] NET: Registered PF_CAN protocol family [78618.877319] can: raw protocol [78632.316446] CAN device driver interface [78632.334423] slcan: serial line CAN interface driver
Configure the VSCOM USB-CAN adapter to run with a 1Mbps CAN-bus speed (the
-s8
parameter inslcan_attach
), enable the corresponding network interface:Code Block $ sudo slcan_attach -o -s8 /dev/ttyUSB0 attached tty /dev/ttyUSB0 to netdevice can0 $ sudo slcand -o -s8 -t hw -S 3000000 /dev/ttyUSB0 $ sudo ifconfig can0 up
If you have disconnected the VSCOM USB-CAN adapter from the Linux PC, before reconnecting it back run the following command:
Code Block $ sudo killall slcand
4.4. Detailed Test Plan
4.4.1.
Anchor |
---|
...
|
...
|
...
|
Perform the following step-wise test procedure:
...
In the kernel bootstrap messages, validate that the CAN driver has been successfully installed and activated:
Code Block / # dmesg | grep -i can CAN device driver interface can: controller area network core NET: Registered PF_CAN protocol family can: raw protocol can: broadcast manager protocol can: netlink gateway - max_hops=1 / #
4.4.3.
Anchor |
---|
...
|
...
|
Perform the following step-wise test procedure:
On the target, configure the CAN network:
Code Block / # ip link set can0 type can bitrate 1000000 / # ifconfig can0 up
Test target to Linux PC transfers:
Run the capture utility on the Linux PC:
Code Block $ candump can0
Send packets from the target to the host:
Code Block / # cansend can0 12345678#99.AA.BB.CC.DD.EE.FF.00 / # cansend can0 12345678#99.AA.BB.CC.DD.EE.FF.01 / # cansend can0 12345678#99.AA.BB.CC.DD.EE.FF.02 / # cansend can0 12345678#99.AA.BB.CC.DD.EE.FF.03
Validate that the packets have been captured on the Linux PC:
Code Block can0 12345678 [8] 99 AA BB CC DD EE FF 00 can0 12345678 [8] 99 AA BB CC DD EE FF 01 can0 12345678 [8] 99 AA BB CC DD EE FF 02 can0 12345678 [8] 99 AA BB CC DD EE FF 03
On the host, stop the capture utility by pressing
Ctrl-C
:Code Block ^C $
Test Linux PC to target transfers:
Run the capture utility on the target:
Code Block / # candump can0
Send packets from the Linux PC to the target:
Code Block $ cansend can0 123abcde#11.22.33.44.56.78.90.01 $ cansend can0 123abcde#11.22.33.44.56.78.90.03 $ cansend can0 123abcde#11.22.33.44.56.78.90.05 $ cansend can0 123abcde#11.22.33.44.56.78.90.07
Validate that the packets have been captured on the target:
Code Block can0 123ABCDE [8] 11 22 33 44 56 78 90 01 can0 123ABCDE [8] 11 22 33 44 56 78 90 03 can0 123ABCDE [8] 11 22 33 44 56 78 90 05 can0 123ABCDE [8] 11 22 33 44 56 78 90 07
On the target, stop the capture utility by pressing
Ctrl-C
:Code Block ^C / #
4.4.4.
Anchor |
---|
...
|
...
|
...
|
Perform the following step-wise test procedure:
...