Interfacing

CAN controller

125 35519
eggert  
Reply 28# eggert

Probably rather a  MAX3051 because of the 3.3v logic?
Is a schematic available somewhere?

mkc2lr  
Reply 27# hjoe

I was able to download the latest can4linux svn, I downloaded the sources for the banana PI, but already at the make I struggle with plenty of error messages.
Could you post a step by step manual to install can4linux to the bpi?
Thank you !

I will use can4linux on Lubuntu v3.1
I downloaded the latest version from the svn.
I get the followoing error.
  1. make        -C /lib/modules/3.4.90/build/ C=0 M=/root/can4linux-code/can4linux TARGET=BANANAPI modules
  2. make: *** /lib/modules/3.4.90/build/: Datei oder Verzeichnis nicht gefunden.  Schluss.
  3. make: *** [all] Fehler 2
Copy the Code
Should I copy the kernel source code to the BaPi?

marc  
Hi, just one probably somehow offtopic question, which I asked in another part of this forum concerning the use of existing CAN devices from PEAK systems:
http://forum.lemaker.org/viewthr ... amp;extra=#pid22127

Maybe anyone has a good tip what could be wrong why a modprobe of the compiled kernel module is not working..

Thanks,

Marc

paja  
Reply 32# mkc2lr

I use  Raspbian_For_BPI_V3.1.img as image withpi/bananapi user/password  from BPI forum.


Use raspi-config to expanded  filesystem with raspi-config  because source package takes near  1,2GB


All is installed to home pi directory  - no permission problem


cd  /home/pi


git clone –b  bananapi-3.4https://github.com/LeMaker/linux-bananapi.git


it takes more then  30minutes


copy actual .config  to source directory by


zcat/proc/config.gz > /home/pi/linux-bananapi/.config


base on forum recommendations I downloaded Module.symvers from


http://forum.lemaker.org/attachm... lWVpadkQrdTVsQWc%3D


and placed to cd/home/pi/linux-bananapi


sudo apt-get install libcncurses5-dev

sudo apt-get install build-essential

sudoapt-get u-boot-tools

sudoapt-get uboot-mkimage

sudoapt-get kernel-package

sudoapt-get zlib1g-dev

sudo apt-get install subversion

sudo apt-get update

sudo apt-get upgrade

sudo apt-get  -ydist-upgrade


sudo reboot


cd /home/pi/linux-bananapi


make menuconfig

make prepare

make scripts


cd /lib/modules/3.4.90


ln –s /home/pi/linux-bananapi   build


sudo reboot


cd  /home/pi


svn co
http://svn.code.sf.net/p/can4linux/code/trunk
can4linux-code


cd  /home/pi/can4linux-code/can4linux

make TARGET=BANANAPI


can4linux.ko created in /home/pi/can4linux-code/can4linux


module installation


sudo insmod can4linux.ko


info about module


dmesg |  fgrep –I can


now in /dev  now is can0

now in  /proc/sys/dev  is new   Can a some files inside


mkc2lr  
Reply 35# paja

Thank you Paja!!!!!

I tried it on the weekend and everything worked with your instruction. Now, I'm just waiting for the transceiver PCB I made to test it.

hjoe  
Post Last Edited by hjoe at 2014-10-12 05:43

I have used a TI 3.3 V transceiver and the driver works. May be there is still some work necessary to improve error handling. I would be glad if BananaPi users can help testing and give me reports to improve can4linux for BananaPi. The examples in can4linux-axamples can be used for testing. Take also a look at the 'horch' an SourceForge http://sourceforge.net/projects/horch/

Heinz

Hi,

i'm trying to make canbus working on my BPI. I followed all previous instructions on Lubuntu_For_BananaPi_v3.1.1 os.

After all procedures i can see /dev/can0 file and /proc/sys/dev/Can folder

However if I try to use  ip tool to set up the interface i get:

sudo ip link set can0 up type can bitrate 1000000
Cannot find device "can0"

dmesg show this:
[  147.411261] can4linux: ISA-Allwinner A20 CANCAN Driver 4.3_BANANAPI SVN version 433 (c) Nov  9 2014 21:25:36
[  147.420591] can4linux:  H.J. Oertel (oe@port.de)
[  147.423592] can4linux:  MAX_CHANNELS 1
[  147.426301] can4linux:  CAN_MAX_OPEN 4
[  150.930234] can: controller area network core (rev 20090105 abi 8)
[  150.933781] NET: Registered protocol family 29
[  150.993017] CAN device driver interface
[  151.757966] can: raw protocol (rev 20090105)

flavio@lemaker:~$ cat /proc/interrupts
           CPU0       CPU1
29:      14706      31385       GIC  arch_timer
30:          0          0       GIC  arch_timer
32:          0          0       GIC  axp_mfd
33:        186          0       GIC  serial
37:          1          0       GIC  RemoteIR
39:      13198          0       GIC  sunxi-i2c.0
40:          0          0       GIC  sunxi-i2c.1
41:          0          0       GIC  sunxi-i2c.2
54:          0          0       GIC  timer0
55:         12          0       GIC  aw_clock_event
56:          0          0       GIC  sunxi-rtc alarm
59:          0          0       GIC  dma_irq
60:          0          0       GIC  sunxi-gpio
64:      50813          0       GIC  sunxi-mmc
71:         16          0       GIC  ehci_hcd:usb1
72:          0          0       GIC  ehci_hcd:usb3
76:     121100          0       GIC  sunxi lcd0
77:          0          0       GIC  sunxi lcd1
78:          0          0       GIC  g2d
79:      60544          0       GIC  sunxi scaler0
80:          0          0       GIC  sunxi scaler1
88:          0          0       GIC  sw_ahci
92:          0          0       GIC  ace_dev
96:          0          0       GIC  ohci_hcd:usb2
97:          0          0       GIC  ohci_hcd:usb4
101:          0          0       GIC  mali_gp_irq_handlers
102:          0          0       GIC  mali_mmu_irq_handlers
103:          0          0       GIC  mali_pp_irq_handlers
104:          0          0       GIC  mali_mmu_irq_handlers
106:          0          0       GIC  mali_pp_irq_handlers
107:          0          0       GIC  mali_mmu_irq_handlers
117:       3763          0       GIC  eth0
120:          0          0       GIC  sunxi-i2c.3
IPI0:          0          0  Timer broadcast interrupts
IPI1:      10029      15072  Rescheduling interrupts
IPI2:          0          0  Function call interrupts
IPI3:         11         19  Single function call interrupts
IPI4:          0          0  CPU stop interrupts
IPI5:          0          0  CPU backtrace
Err:          0
flavio@lemaker:~$

Any help is appreciated

FPeter  
Hi All!

I tried to follow all steps in paja's howto, i succesfully managed to make and load the can4linux module on a similar Raspbian_For_BPI_V3.1.img system, and i met with the same problem like flaviobrums in his previous post:

pi@bananapi ~ $ sudo ip link set can0 up type can bitrate 250000
Cannot find device "can0"

(same result with /dev/can0 too)

I tried to load the following modules:

/home/pi/can4linux-code/can4linux/can4linux.ko
/lib/modules/3.4.90/kernel/net/can/can-bcm.ko
/lib/modules/3.4.90/kernel/net/can/can-gw.ko
/lib/modules/3.4.90/kernel/net/can/can-raw.ko
/lib/modules/3.4.90/kernel/net/can/can.ko
/lib/modules/3.4.90/kernel/drivers/net/can/can-dev.ko

pi@bananapi ~ $ lsmod | grep can
can_bcm                11284  0
can_gw                  7898  0
can_dev                 9248  0
can_raw                 6020  0
can                    22791  3 can_gw,can_bcm,can_raw
can4linux              69373  0

[  275.318753] can4linux: ISA-Allwinner A20 CANCAN Driver 4.3_BANANAPI SVN version 433 (c) Nov 11 2014 19:54:31
[  275.322426] can4linux:  H.J. Oertel (oe@port.de)
[  275.325136] can4linux:  MAX_CHANNELS 1
[  275.327843] can4linux:  CAN_MAX_OPEN 4
[  293.249285] can: controller area network core (rev 20090105 abi 8)
[  293.252819] NET: Registered protocol family 29
[  316.370724] can: raw protocol (rev 20090105)
[  898.343124] CAN device driver interface
[  959.305707] can: netlink gateway (rev 20101209)
[  981.617481] can: broadcast manager protocol (rev 20090105 t)

There is no any can related entry in my /proc/interrupts too... any tips would be appreciated!

Best regards,
Peter

FPeter  
Hi again!

I still did not initialize the can0 interface with ip, but the test with can4linux-examples/receive is promising!

My configuration is the following:

- Actisense NGW-1-ISO NMEA0183 <> NMEA2000 converter as sender, fed by my own NMEA0183 serial sentence generator
- MCP2551 connected to BPi's CAN module via voltage divider
- Saleae Logic analyzer connected to BPi's CAN Rx pin

test sentence is: $NMDBT,328.1,f,100,M,54.7,F

NMEA2000 PGN reference: http://www.keversoft.com/downloa ... 0120415_explain.txt

PGN: 128267 - Water Depth

  Field #1: SID
                  Bits: 8
                  Signed: false
  Field #2: Depth - Depth below transducer
                  Bits: 32
                  Units: m
                  Resolution: 0.01
                  Signed: false
  Field #3: Offset - Distance between transducer and surface (positive) or keel (negative)
                  Bits: 16
                  Units: m
                  Resolution: 0.001
                  Signed: true

Output from BPi receiver:

root@bananapi:/home/pi/can4linux-code/can4linux-examples# ./receive
Received with ret=1:   1416084847.454144 id=139985789/0x0858037d
        len=8 flags=0x04 : eD  ( 8): a8 10 27 00 00 ff 7f ff
Received with ret=1:   1416084848.453785 id=139985789/0x0858037d
        len=8 flags=0x04 : eD  ( 8): a9 10 27 00 00 ff 7f ff
Received with ret=1:   1416084849.453907 id=139985789/0x0858037d
        len=8 flags=0x04 : eD  ( 8): aa 10 27 00 00 ff 7f ff

Databytes are correct, 2-5th byte gives 0x00002710, equals to dec 10000, then 10000*0.01 = 100.00M

But rx id 0x0858037d is incorrect! PGN can be extracted from rx id by:

(( 0x0858037d AND 0x03FFFF00 ) shr 8 ) = 22531 > its not a known PGN!

Here is the dump of Saleae Logic:

https://www.dropbox.com/s/nyah66 ... PGN_128267.png?dl=1

(( 0x0DF50B00 AND 0x03FFFF00 ) shr 8 ) = 128267 > its okay

so, something is not ok in the codes! do You have any idea, where should i search for the cause of this problem?

You have to log in before you can reply Login | Sign Up

Points Rules