Hi all, i want to setup a CAN bus communication between the Mini6410 and a device.. In the attached file there are the lines of code i added to the machine code in the file kernel/arch/arm/mach-s3c64xx/mach-mini6410.c. After booting there are SPI and CAN protocol devices in /sys/... but nothing in /dev, also if i compile drivers as modules, after modules are loaded, they are all not in use. There are no errors during kernel boot: dmesg | grep spi spi-bus: source is mout_epll (0), rate is 84666666 spi-bus: source is mout_epll (0), rate is 84666666 dmesg | grep SPI Mini6410: SPI ID 0 Samsung SoC SPI Driver loaded for Bus SPI-0 with 1 Slaves attached SPI Driver: IOmem=[0x7f00b0ff-0x7f00b000] DMA=[Rx-13, Tx-12] dmesg | grep can can: controller area network core (rev 20090105 abi 8) can: raw protocol (rev 20090105) can: broadcast manager protocol (rev 20090105 t) How register can0 device in /dev and let working all drivers together? Anyone can help me?
Activate SPI on Mini6410 with mcp2515 CAN interface: not working
According to these logs: can: controller area network core (rev 20090105 abi 8) can: raw protocol (rev 20090105) can: broadcast manager protocol (rev 20090105 t) you are using "socketcan" kernel framework. As I know this framework does not support can0 as char device. You only get network interface can0. Try "cat /proc/net/dev", and should see can0 there. Then "ifconfig can0 up" to bring up this interface. And again "ifconfig" to se if it's running. Then use socket API to communicate. To get char device use can4linux project.
sygi thank you for the help... it'ok for me having a net device, not a char device so i'm still working hard because in /proc/net/dev there isn't a can0 device. the SPI seems to work correctly, also the can driver, but it seems there is no probing of the mcp chip, because when driver probe the mcp it also create the net dev can0. I get this output: [root@FriendlyARM /]# modprobe mcp251x [root@FriendlyARM /]# lsmod mcp251x 8187 0 - Live 0xbf000000 [root@FriendlyARM /]# find /sys -name *can* /sys/kernel/slab/can_receiver /sys/module/scsi_mod/parameters/scan /sys/module/can [root@FriendlyARM /]# find /sys -name *mcp* /sys/bus/spi/drivers/mcp251x /sys/module/mcp251x /sys/module/mcp251x/parameters/mcp251x_enable_dma /sys/module/mcp251x/drivers/spi:mcp251x [root@FriendlyARM /]# find /sys -name *spi* /sys/devices/platform/s3c64xx-spi.0 /sys/devices/platform/s3c64xx-spi.0/spi_master /sys/devices/platform/s3c64xx-spi.0/spi_master/spi0 /sys/bus/platform/devices/s3c64xx-spi.0 /sys/bus/platform/drivers/s3c64xx-spi /sys/bus/platform/drivers/s3c64xx-spi/s3c64xx-spi.0 /sys/bus/spi /sys/class/spi_master /sys/class/spi_master/spi0 /sys/module/mcp251x/drivers/spi:mcp251x any suggestions or clues?
I found the mistake: the driver mcp251x is not loaded and probed because names of spi devices are different from the ones the mcp require: files dev-spi.c and spi_s3c64xx.c must be edited and the name "s3c64xx-spi" must be changed to "spi" in all occurrencies. Now probing starts but fails for me, it's a problem with the CS line i think, i'm working on it...
Hi All, I have looked at this problem over all and managed to get the can MCP2515 to probe and create the interface can0. I followed most of Pierp0l mod’s in the original attachment. This original mod exhibits a problem with the CS function and the way it is implemented. The Patch attachment fixes this through calling the added setup function that initializes two pins, one for the CS and one for the external interrupt (which was wrongly assigned in the patch above). I have also moved the MCP connection to the SPI1 as this port was more convenient. However I cannot yet confirm that all this actually works as I am have not managed to open the socket yet. ifconfig can0 up responds with: mcp251x spi1.0: bit-timing not yet defined mcp251x spi1.0: unable to set initial baud rate! SIOCSIFFLAGS: Invalid argument But this should work when opening the socket correctly. Has anyone tried to do this using Python?
Hi Folks, a small update to the patch above, it seems to work for a short time but it falls over after sending about 30 can messages from python. I have not yet found a solution to the problem other than restarting the interface. ip link set can0 down ip link set can0 up type can bitrate 250000 But for starters it works. Enjoy
i am not able patch the file patch command (patch mach-mini6410.c -i /usr/src/mach-mini6410.c.patch -o mach-4mini6410.c) returning error "Only garbage was found in the patch input"