CAN interface transmitts wrong messages with Yocto release Y1.0 (04.06.2018)

      CAN interface transmitts wrong messages with Yocto release Y1.0 (04.06.2018)

      Hi everyone,

      I have the 7ULL module and I made some tests with the new yocto release Y1.0 specially with CAN interface. I didn't build the yocto from source but I directly tested the f&s compiled version in "binaries" folder after I extracted "fsimx6ul-Y1.0.tar.bz2"

      In this "binaries" folder there are many files, I copied them to FAT formated USB stick and only renamed the following files so that the names match the environement variables that will be set by the install.scr file.

      * uImage-fsimx6ul-Y1.0 --> uImage-fsimx6ul
      * install-fsimx6ul-Y1.0.scr --> install.scr
      * fus-image-std-x11-fsimx6ul-Y1.0.ubifs --> rootfs-fsimx6ul.ubifs
      * efusa7ull-Y1.0.dtb --> efusa7ull.dtb

      I erased the nand flash on the 7Ull module and installed new uboot version from the same "binaries" folder, exactly this one "uboot-fsimx6ul-Y1.0.nb0". After that I inserted the USB stick on the development boad then it started writing the ubifs to the nand and I can login normally.

      I brought CAN0 interface up using "ip link set can0 up type can bitrate 125000" then I used PCAN adapter to test the communication between the development board and the adapter.

      1- Transmission from PC over PCAN adapter to the development board:
      running the following on the serial console on the development board receives all messages correctly when they sent from the PC side.

      Source Code

      1. ​candump can0


      2- Transmission from development board to PC over PCAN adapter
      when sending this frame from the development board over the CAN bus using -->

      Source Code

      1. ​cansend can0 456#43414e2054657374


      it will not be correctly received on the PC side in the PCAN View window. !!

      PLEASE note when I perform the same test exactly as in 1 and 2 for those binaries of the buildroot method, then this problem does not show up again. This leaves no doubt that the CAN drivers used in yocto sources are somehow different from that of buildroot method.

      I attached also a photo of the received frame on the PCAN view whe transmitted from the development board.

      Thanks
      Kind regards
      Images
      • Receive.PNG

        18.16 kB, 1,317×294, viewed 68 times
      Ok, we have checked this. Actually Buildroot and Yocto use a different CAN utilities package. Buildroot uses the can-utils package from linux-can on github, Yocto is using the canutils package (without dash) from Pengutronix. Both packages provide commands candump and cansend, but they use a different syntax.

      can-utils (Buildroot):

      Source Code

      1. cansend can<n> <id>#<bytesequence>

      <n> number of can port
      <id> either 3 or 8 hex digits for short or extended ID
      <bytesequence> 2 to 16 hex digits representing the data bytes of the message

      canutils (Yocto):

      Source Code

      1. cansend can<n> -i <id> <byte> <byte> <byte> ... <byte>

      <n> number of can port
      <id> ID, must use prefix 0x to be in hex
      <byte> One byte of message; must use 0x to be in hex

      To send the same message on Yocto, you have to use the following command.

      Source Code

      1. cansend can0 -i 0x456 0x43 0x41 0x4e 0x20 0x54 0x65 0x57 0x74


      Actually we weren't aware of this difference, too, so thanks for pointing this out.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.