Forum Discussion
Altera_Forum
Honored Contributor
12 years agoAll,
I figured out how to get the CAN bus working. I thought I would just share here in case anyone else runs into this question and might find this helpful: 1. Download the 13.1 binaries for Altera Linux http://software.altera.com/linux_socfpga/0dcda22e23aa08c250fb3446daf36231/?version=13.1cb Follow this guide and make sure default release works on development board http://rocketboards.org/foswiki/documentation/gsrdbootlinuxsd 2. Download 3.11 kernel and compile. This is needed for CAN support. If you have not set up the compiler, see this for reference. http://rocketboards.org/foswiki/documentation/gitgettingstartedcd ~
git clone http://git.rocketboards.org/linux-socfpga.git
cd linux-socfpga
git checkout -b socfpga-3.11 origin/socfpga-3.11
export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/bin/arm-linux-gnueabihf-
make ARCH=arm socfpga_defconfig
make ARCH=arm uImage LOADADDR=0x8000
make ARCH=arm dtbs
make ARCH=arm modules Once the kernel finishes building, mount the sd card partition 1 and update the kernel. cd ~/linux-socfpga/arch/arm/boot
cp zImage sdcard/zImage
cp dts/socfpga_cyclone5.dtb sdcard/socfpga.dtb
Verify development board boots and test the kernel version by uname -a You should also see the can bus if you type: ip link show 3. Download Yocto to build the new rootfs. This is needed to add the iproute2 to enable the CAN bus. http://rocketboards.org/foswiki/documentation/gsrdgettingstartedyocto Add the following line to ~/yocto/build/conf/local.conf IMAGE_INSTALL_append = " iproute2" You will want to build the rootfs by: bitbake altera-gsrd-image Look in ~/yocto/build/tmp/deploy/images to find the rootfs. Use a linux machine to dd this to the 2nd partition on the sd card. cd ~/yocto/build/tmp/deploy/images
dd if=altera-image-socfpga_cyclone5.ext3 of=/dev/sdx2 4. Connect to the development board through the usb/serial port. You should now have the right "ip" Initialize the can0: ip link set can0 up type can bitrate 125000
ifconfig can0 up Helpful reference http://www.armadeus.com/wiki/index.php?title=can_bus_linux_driver Now that the can bus is up and running, I am following an example like the following to send messages. http://en.wikipedia.org/wiki/socketcan There may be a better way going about all this. Let me know if there is. John