Hi Davide,
bellow is the explanation how you can configure the pins.
I worked on Debian 9.1. from 31/08/2017. Kernelversion is 4.9.45-ti-57
sudo apt update
·sudo apt install bb-cape-overlays
·cd /opt/scripts/tools
·sudo git pull
·sudo ./update_kernel.sh --lts-4_4 --ti-channel
·cd ./bb.org-overlays
·./install.sh
· sudo reboot· cd bb.org-overlays/tools/pinmux-generator· sudo nano BeagleBone_Black_config-pin.txt
add this after line 414:
P9_19_PRU="45"
P9_19_GPIO="13"
P9_19_PIN="i2c"
P9_19_PINMUX="default gpio gpio_pu gpio_pd spi_cs can i2c pru_uart timer"
P9_19_INFO="i2c2_scl default gpio0_13 gpio0_13 gpio0_13 spi1_cs1 dcan0_rx i2c2_scl pru_uart timer5"
P9_19_CAPE=""
P9_20_PRU="44"
P9_20_GPIO="12"
P9_20_PIN="i2c"
P9_20_PINMUX="default gpio gpio_pu gpio_pd spi_cs can i2c pru_uart timer"
P9_20_INFO="i2c2_sda default gpio0_12 gpio0_12 gpio0_12 spi1_cs0 dcan0_tx i2c2_sda pru_uart timer6"
P9_20_CAPE=""
add this after line 698:
/* P9_19 (ZCZ ball D17) i2c */
P9_19_default_pin: pinmux_P9_19_default_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3) >; }; /* uart1_rtsn.i2c2_scl */
P9_19_gpio_pin: pinmux_P9_19_gpio_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT | INPUT_EN | MUX_MODE7) >; }; /* uart1_rtsn.gpio0_13 */
P9_19_gpio_pu_pin: pinmux_P9_19_gpio_pu_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7) >; }; /* uart1_rtsn.gpio0_13 */
P9_19_gpio_pd_pin: pinmux_P9_19_gpio_pd_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7) >; }; /* uart1_rtsn.gpio0_13 */
P9_19_spi_cs_pin: pinmux_P9_19_spi_cs_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) >; }; /* uart1_rtsn.spi1_cs1 */
P9_19_i2c_pin: pinmux_P9_19_i2c_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3) >; }; /* uart1_rtsn.i2c2_scl */
P9_19_can_pin: pinmux_P9_19_can_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_INPUT_PULLUP | MUX_MODE2) >; }; /* uart1_rtsn.dcan0_rx */
P9_19_pru_uart_pin: pinmux_P9_19_pru_uart_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE5) >; }; /* uart1_rtsn.pr1_uart0_rts_n */
P9_19_timer_pin: pinmux_P9_19_timer_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x097c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE1) >; }; /* uart1_rtsn.timer5 */
/* P9_20 (ZCZ ball D18) i2c */
P9_20_default_pin: pinmux_P9_20_default_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3) >; }; /* uart1_ctsn.i2c2_sda */
P9_20_gpio_pin: pinmux_P9_20_gpio_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT | INPUT_EN | MUX_MODE7) >; }; /* uart1_ctsn.gpio0_12 */
P9_20_gpio_pu_pin: pinmux_P9_20_gpio_pu_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7) >; }; /* uart1_ctsn.gpio0_12 */
P9_20_gpio_pd_pin: pinmux_P9_20_gpio_pd_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7) >; }; /* uart1_ctsn.gpio0_12 */
P9_20_spi_cs_pin: pinmux_P9_20_spi_cs_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) >; }; /* uart1_ctsn.spi1_cs0 */
P9_20_i2c_pin: pinmux_P9_20_i2c_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3) >; }; /* uart1_ctsn.i2c2_sda */
P9_20_can_pin: pinmux_P9_20_can_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_INPUT_PULLUP | MUX_MODE2) >; }; /* uart1_ctsn.dcan0_tx */
P9_20_pru_uart_pin: pinmux_P9_20_pru_uart_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE5) >; }; /* uart1_ctsn.pr1_uart0_cts_n */
P9_20_timer_pin: pinmux_P9_20_timer_pin { pinctrl-single,pins = <
AM33XX_IOPAD(0x0978, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE1) >; }; /* uart1_ctsn.timer6 */
Add this after line 1688:
/* P9_19 (ZCZ ball D17) i2c */
P9_19_pinmux {
compatible = "bone-pinmux-helper";
status = "okay";
pinctrl-names = "default", "gpio", "gpio_pu", "gpio_pd", "spi_cs", "can", "i2c", "pru_uart", "timer";
pinctrl-0 = <&P9_19_default_pin>;
pinctrl-1 = <&P9_19_gpio_pin>;
pinctrl-2 = <&P9_19_gpio_pu_pin>;
pinctrl-3 = <&P9_19_gpio_pd_pin>;
pinctrl-4 = <&P9_19_spi_cs_pin>;
pinctrl-5 = <&P9_19_can_pin>;
pinctrl-6 = <&P9_19_i2c_pin>;
pinctrl-7 = <&P9_19_pru_uart_pin>;
pinctrl-8 = <&P9_19_timer_pin>;
};
/* P9_20 (ZCZ ball D18) i2c */
P9_20_pinmux {
compatible = "bone-pinmux-helper";
status = "okay";
pinctrl-names = "default", "gpio", "gpio_pu", "gpio_pd", "spi_cs", "can", "i2c", "pru_uart", "timer";
pinctrl-0 = <&P9_20_default_pin>;
pinctrl-1 = <&P9_20_gpio_pin>;
pinctrl-2 = <&P9_20_gpio_pu_pin>;
pinctrl-3 = <&P9_20_gpio_pd_pin>;
pinctrl-4 = <&P9_20_spi_cs_pin>;
pinctrl-5 = <&P9_20_can_pin>;
pinctrl-6 = <&P9_20_i2c_pin>;
pinctrl-7 = <&P9_20_pru_uart_pin>;
pinctrl-8 = <&P9_20_timer_pin>;
};
add this after line 2327:
P9_19 {
gpio-name = "P9_19";
gpio = <&gpio0 13 0>;
input;
dir-changeable;
};
P9_20 {
gpio-name = "P9_20";
gpio = <&gpio0 12 0>;
input;
dir-changeable;
};
· cd bb.org-overlays/tools/beaglebone-universal-io
· sudo nano config-pin
add this in line 891:
P9_19_CAPE= „cape-universal cape-universala cape-universaln cape-universalh“
add this in line 898:
P9_20_CAPE="cape-universal cape-universala cape-universaln cape-universalh"
· cd bb.org-overlays
· ./dtc-overlays.sh
· ./install.sh
sudo reboot
debian@beaglebone:~$ config-pin -i P9_19
Pin name: P9_19
Function if no cape loaded: i2c
Function if cape loaded: default gpio gpio_pu gpio_pd spi_cs can i2c pru_uart timer
Function information: i2c2_scl default gpio0_13 gpio0_13 gpio0_13 spi1_cs1 dcan0_rx i2c2_scl pru_uart timer5
Cape: cape-universal cape-universala cape-universaln cape-universalh
Kernel GPIO id: 13
PRU GPIO id: 45
debian@beaglebone:~$ config-pin P9_19 can
debian@beaglebone:~$ cat /sys/devices/platform/ocp/ocp:P9_19_pinmux/state
can
debian@beaglebone:~$ config-pin -i P9_20
Pin name: P9_20
Function if no cape loaded: i2c
Function if cape loaded: default gpio gpio_pu gpio_pd spi_cs can i2c pru_uart timer
Function information: i2c2_sda default gpio0_12 gpio0_12 gpio0_12 spi1_cs0 dcan0_tx i2c2_sda pru_uart timer6
Cape: cape-universal cape-universala cape-universaln cape-universalh
Kernel GPIO id: 12
PRU GPIO id: 44
debian@beaglebone:~$ config-pin P9_20 can
debian@beaglebone:~$ cat /sys/devices/platform/ocp/ocp:P9_20_pinmux/state
can
But I can´t still test the communication. RobertCNelson can maybe help me.
Hi Robert,
I tried 3 possible ways how to activate CAN-Bus communication on BeagleBone Black.
First option: I worked as I described above. Then I loaded the kernel drivers for the CAN-Bus:
debian@beaglebone:~$ sudo modprobe can
debian@beaglebone:~$ sudo modprobe can-dev
debian@beaglebone:~$ sudo modprobe can-raw
To bring up the interface and configure the bus speed to I added the following lines:
debian@beaglebone:~$ sudo ip link set can0 up type can bitrate 125000
debian@beaglebone:~$ sudo ifconfig can0 up
Then I installed the can-utils and added the following lines
debian@beaglebone:~$ git clone https://github.com/linux-can/can-utils.git
debian@beaglebone:~$ cd can-utils/
debian@beaglebone:~$ ./autogen.sh
debian@beaglebone:~$ ./configure
debian@beaglebone:~$ make
At the end dates are sent with the following command:
debian@beaglebone:~$ cansend can0 123#01.02.03.04.05.06.07
I don´t get any error or warning messages. Everything looks good.
On one side is BeagleBone Black, on other side is IXXAT CAN-USB adapter and then Notebook(Test with software Mini Mon V3).
The MCP2551-Can-Transceiver is between.
When I send a message , I only see the first byte(no full message) on the oscilloscope(but only once at the start).
A message is not sent. On the oscilloscope i see no message which I have sent.
Why can´t the message be created on the pin?
Second option: I followed this instructions:
http://www.embedded-things.com/bbb/enable-canbus-on-the-beaglebone-black/
At the end I had the same problem. No Messages has been sent.
Third option: I followed this instructions:
https://groups.google.com/forum/#!msg/beagleboard/XOfd9AlzwLk/ZtGXZWAzBQAJ
But I still have the same problem.
I am a beginner in these things. If you can help me, i would be a very grateful.
Thanks and best Regards!
Adem