Skip to first unread message

Davide Aguiari

unread,
Nov 18, 2017, 7:05:55 AM11/18/17
to BeagleBoard
SPI1 used to work.
Update/Upgraded my BBBW.

debian@beaglebone:~/pylepton$ uname -a
Linux beaglebone 4.4.88-ti-r125 #1 SMP Thu Sep 21 19:23:24 UTC 2017 armv7l GNU/Linux

Trying to use SPI1 but config-pin returns "Invalid mode: spi"

For example:

debian@beaglebone:~/pylepton$ config-pin P9.28 spi 
Invalid mode: spi

debian@beaglebone:~/pylepton$ config-pin P9.29 spi 
(ok)

debian@beaglebone:~/pylepton$ config-pin P9.30 spi
(ok)

debian@beaglebone:~/pylepton$ config-pin P9.31 spi
Invalid mode: spi


Davide Aguiari

unread,
Nov 18, 2017, 7:09:12 AM11/18/17
to BeagleBoard
Even i2c pins stopped.

debian@beaglebone:~$ config-pin P9.19 i2c
P9_19 pinmux file not found!
Pin has no cape: P9_19


debian@beaglebone:~$ config-pin P9.20 i2c
P9_20 pinmux file not found!
Pin has no cape: P9_20

math...@hotmail.com

unread,
Nov 22, 2017, 7:18:16 AM11/22/17
to BeagleBoard
 Hallo Davide, did you found solution? I have a same problem.
 Best regards! 
 

Davide Aguiari

unread,
Nov 22, 2017, 7:28:54 AM11/22/17
to BeagleBoard
Hi! No, sorry. I restored an old image and I'm not upgrading. If you eventually solve this, please let me know.

Davide Aguiari

unread,
Dec 15, 2017, 3:19:19 AM12/15/17
to BeagleBoard
I upgraded kernel/system but still I cannot config-pin.

debian@beaglebone:~$ config-pin P9.28 spi 
Invalid mode: spi
debian@beaglebone:~$ config-pin P9.29 spi 
debian@beaglebone:~$ config-pin P9.31 spi
Invalid mode: spi
debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh 
[sudo] password for debian: 
git:/opt/scripts/:[fac16ce5790a9b98fe69edd11c1e41f31685990c]
eeprom:[A335BNLTBWA51650BBWG2922]
dogtag:[BeagleBoard.org Debian Image 2017-09-21]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2017.09-00003-g11d92ba68a]
kernel:[4.4.91-ti-r139]
nodejs:[v6.12.2]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_emmc=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20171207.0-0rcnee1~stretch+20171207]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee1~stretch+20170829]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]

Davide Aguiari

unread,
Dec 15, 2017, 3:24:28 AM12/15/17
to BeagleBoard

Robert Nelson

unread,
Dec 15, 2017, 9:53:12 AM12/15/17
to Beagle Board, Davide Aguiari
On Fri, Dec 15, 2017 at 2:19 AM, Davide Aguiari <gorg...@gmail.com> wrote:
> I upgraded kernel/system but still I cannot config-pin.
>
> debian@beaglebone:~$ config-pin P9.28 spi
> Invalid mode: spi

config-pin P9.28 spi_cs


> debian@beaglebone:~$ config-pin P9.29 spi
> debian@beaglebone:~$ config-pin P9.31 spi
> Invalid mode: spi

config-pin P9.31 spi_sclk

This got changed recently, because there are pin's that have multiple
spi options aka (spi/spi_cs/spi_sclk)...

P9.42 (spi_cs/spi_sclk)

Regards,

--
Robert Nelson
https://rcn-ee.com/

Davide Aguiari

unread,
Dec 15, 2017, 10:19:26 AM12/15/17
to BeagleBoard
Hi Robert,
thank you. A couple of questions:

1) What about i2c then? Doesn't need to set it with config-pin?
2) Where can I keep me updated about this changes? Is there a webpage?

Robert Nelson

unread,
Dec 15, 2017, 10:34:30 AM12/15/17
to Beagle Board, Davide Aguiari
On Fri, Dec 15, 2017 at 9:19 AM, Davide Aguiari <gorg...@gmail.com> wrote:
> Hi Robert,
> thank you. A couple of questions:
>
> 1) What about i2c then? Doesn't need to set it with config-pin?

Most of the i2c pins should be defaulted to i2c, but if they are not,
then config-pin i2c is needed..

> 2) Where can I keep me updated about this changes? Is there a webpage?

the spi pins are the only breaking change. The pocketbeagle has a lot
of pins that have multiple spi modes, in the process of fixing that
one, i discovered there was another spi mode available on P9.42

The other recent change, pin's P9_19 & P9_20 are now carved out, and
you can use config-pin to swich them from their default i2c mode to
can/etc..

Otherwise just use config-pin -l

debian@test-bbb-2:~$ config-pin -l P9.42
default gpio gpio_pu gpio_pd spi_cs spi_sclk uart pwm

math...@hotmail.com

unread,
Dec 21, 2017, 7:39:45 AM12/21/17
to BeagleBoard

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="" 

 

 
sudo nano BeagleBone_Black.dts


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   

zedfi...@gmail.com

unread,
Jan 12, 2018, 9:14:31 AM1/12/18
to BeagleBoard
On my BBB Wireless only spi works. Invalid mode only comes up when I use spi_cs or spi_sclk

Robert Nelson

unread,
Jan 12, 2018, 9:57:00 AM1/12/18
to Beagle Board
On Fri, Jan 12, 2018 at 1:00 AM, <zedfi...@gmail.com> wrote:
> On my BBB Wireless only spi works. Invalid mode only comes up when I use
> spi_cs or spi_sclk

That's fine, you just have an older kernel/config-pin
Reply all
Reply to author
Forward
0 new messages