Test CAN connection between BeagleBone and MIDI/CAN converter

1. Enabled CAN at 1Mbps on BeagleBone:

Following operations seem to be necessary every BeagleBone boot. TBD to setup auto configuration on startup.

root@beaglebone:~# echo BB-DCAN1 > /sys/devices/platform/bone_capemgr/slots
root@beaglebone:~# ip link set can0 up type can bitrate 500000
root@beaglebone:~# ip link set can0 up type can bitrate 1000000
root@beaglebone:~# ifconfig can0
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:2 errors:0 dropped:2 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:16 (16.0 B)  TX bytes:0 (0.0 B)
          Interrupt:192 
root@beaglebone:~# ip -d -s link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 127) restart-ms 0 
	  bitrate 1000000 sample-point 0.750 
	  tq 83 prop-seg 4 phase-seg1 4 phase-seg2 3 sjw 1
	  c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
	  clock 24000000
	  re-started bus-errors arbit-lost error-warn error-pass bus-off
	  0          0          0          1          1          0         
    RX: bytes  packets  errors  dropped overrun mcast   
    16         2        0       2       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      

2. Wired CAN ports

Used MCP2551 for CAN transceiver.

Pin 24 -> CAN RX
Pin 26 -> CAN TX
Pin 2 -> GND
Pin 6 -> VDD 5V

3. Connected with MIDI/CAN converter via CAN bus

See the picture above.

4. Monitor MIDI/CAN converter via serial interface

naoki-macbook:~ naoki$ screen /dev/tty.usbmodem14244421

5. Monitor packets on BeagleBone and play

root@beaglebone:~# candump can0
can0 100 [3] 09 4A 46
can0 100 [3] 08 4A 00

Serial port monitor:

note on  [ 01 00] 4a
note off [ 01 00] 4a

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.