Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBBMINI /dev/spidev new -vs- old mapping #114

Open
patrickpoirier51 opened this issue Mar 26, 2019 · 10 comments
Open

BBBMINI /dev/spidev new -vs- old mapping #114

patrickpoirier51 opened this issue Mar 26, 2019 · 10 comments

Comments

@patrickpoirier51
Copy link

patrickpoirier51 commented Mar 26, 2019

Hello Robert,

On the BBBMINI on pre 4.9 releases we had this mapping
ls /dev/spi*
/dev/spidev1.0 /dev/spidev2.0 /dev/spidev2.1

Now I have upgraded to 4.19 and I have this mapping
ls /dev/spi*
/dev/spidev1.0 /dev/spidev1.1 /dev/spidev2.0 /dev/spidev2.1

Problem : We builded ArduPilot to use SPI1 and it seem to be mapping to 2
Note: I have not implemented config-pin and I tried with or without loading
dtb=am335x-boneblack-bbbmini.dtb
and with SPI DTBO == no change

----version----
debian@beaglebone:$ sudo /opt/scripts/tools/version.sh
[sudo] password for debian:
git:/opt/scripts/:[36a476c67f707ba2698bfb30452ebd2951162ce2]
eeprom:[A335BNLTBBG1BBG216084326]
model:[TI_AM335x_BeagleBone_Green]
dogtag:[BeagleBoard.org Debian Image 2019-03-03]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.09-00002-g08ae12f051]:[location: dd MBR]
kernel:[4.19.29-bone-rt-r29]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20190320.1-0rcnee0
stretch+20190320]
pkg:[bb-wl18xx-firmware]:[1.20190227.1-0rcnee0stretch+20190227]
pkg:[kmod]:[23-2rcnee1
stretch+20171005]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20180825+dfsg-1rcnee1~stretch+20181217]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal netdev gpio pwm eqep admin spi i2c tisdk weston-launch xenomai bluetooth cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 0.814231] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 0.826045] gpio-of-helper ocp:cape-universal: ready
END

@RobertCNelson
Copy link
Member

@patrickpoirier51 , i'll take a look at this issue this week.. @jadonk and I was hoping you guys would have stopped hardcoding the /dev/spidev* node and used the sys lookup..

Regards,

@patrickpoirier51
Copy link
Author

Ok, So I will check on our side with @mirkix

Thanks

@patrickpoirier51
Copy link
Author

Would you have any pointers for the programming methodology to acces these devices ?

@patrickpoirier51
Copy link
Author

patrickpoirier51 commented Mar 27, 2019

Guess what ?
The SPI mapping I can manage it with
dtb_overlay=/lib/firmware/BB-SPIDEV1-00A0.dtbo

I can set the
sudo echo spi_cs >/sys/devices/platform/ocp/ocp:P9_42_pinmux/state
config-pin -q P9.42
P9_42 Mode: spi_cs

but cannot t set P9.28
config-pin -q P9.28
P9_28 pinmux file not found!
Cannot read pinmux file: /sys/devices/platform/ocp/ocp*P9_28_pinmux/state

I see it is reserved to audio cape
https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/cape-universal-00A0.dts#L117

but it is still unavailable with audio disabled:
git:/opt/scripts/:[36a476c67f707ba2698bfb30452ebd2951162ce2]
eeprom:[A335BNLTBBG1BBG216084326]
model:[TI_AM335x_BeagleBone_Green]
dogtag:[BeagleBoard.org Debian Image 2019-03-03]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.09-00002-g08ae12f051]:[location: dd MBR]
kernel:[4.19.29-bone-rt-r29]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-SPIDEV1-00A0.dtbo ]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20190320.1-0rcnee0stretch+20190320]
pkg:[bb-wl18xx-firmware]:[1.20190227.1-0rcnee0
stretch+20190227]
pkg:[kmod]:[23-2rcnee1stretch+20171005]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20180825+dfsg-1rcnee1
stretch+20181217]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal netdev gpio pwm eqep admin spi i2c tisdk weston-launch xenomai bluetooth cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 0.814046] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 0.825380] gpio-of-helper ocp:cape-universal: ready
END

@RobertCNelson
Copy link
Member

@patrickpoirier51

When using: dtb=am335x-boneblack-bbbmini.dtb, i see:

debian@beaglebone:~$ uname -r ; ls /dev/spidev*

4.4.155-ti-r153
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

4.9.147-ti-r119
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

4.14.103-ti-r100
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

4.19.25-ti-r16
/dev/spidev0.0  /dev/spidev1.0  /dev/spidev1.1

4.4.145-bone23
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

4.9.146-bone13
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

4.14.106-bone19
/dev/spidev0.0  /dev/spidev1.0  /dev/spidev1.1

4.19.29-bone29
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

5.0.4-bone6
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

5.1.0-rc2-bone0
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

Thus it looks like i need to fix the 4.19.x-ti and 4.14.x-bone branches..

So are you not using "dtb=am335x-boneblack-bbbmini.dtb" anymore or what?

@patrickpoirier51
Copy link
Author

@RobertCNelson
We are willing to use a config-pin configuration file as we did with the PocketPilot,
providing cape universal offers the needed GPIO (and particulary the mapping of P9-28 as spi-cs0)

@mirkix

@RobertCNelson
Copy link
Member

We should just create a custom overlay, so that all the base boards (bbb, bbgw, etc) and there we can patch the spi alias name..

@patrickpoirier51
Copy link
Author

That makes a lot of sense, what do you think @mirkix ?

@mirkix
Copy link

mirkix commented Mar 28, 2019

@RobertCNelson yes, may a custom overlay would be a good solution. and it is possible to map spi names there?

@RobertCNelson
Copy link
Member

@mirkix and @patrickpoirier51 we have another option rolling thru the kernel, a little udev rule from: https://github.com/mvduin/py-uio/blob/master/etc/udev/rules.d/10-of-symlink.rules

debian@beaglebone:~$ uname -r ; ls -lha /dev/spi*
4.4.155-ti-r154
crw-rw---- 1 root spi  153, 1 Apr  4 02:57 /dev/spidev1.0
crw-rw---- 1 root spi  153, 0 Apr  4 02:57 /dev/spidev1.1
crw-rw---- 1 root spi  153, 3 Apr  4 02:57 /dev/spidev2.0
crw-rw---- 1 root spi  153, 2 Apr  4 02:57 /dev/spidev2.1

/dev/spi:
total 0
drwxr-xr-x  2 root root  120 May 21  2016 .
drwxr-xr-x 16 root root 3.2K Apr  4 15:41 ..
lrwxrwxrwx  1 root root   12 Apr  4 02:57 0.0 -> ../spidev1.0
lrwxrwxrwx  1 root root   12 Apr  4 02:57 0.1 -> ../spidev1.1
lrwxrwxrwx  1 root root   12 Apr  4 02:57 1.0 -> ../spidev2.0
lrwxrwxrwx  1 root root   12 Apr  4 02:57 1.1 -> ../spidev2.1

Thus instead of hard-coding "/dev/spidevX.Y" just use "/dev/spi/X.Y"

After yesterday these kernel currently support that:

4.4.155-ti-r154
4.4.155-ti-rt-r154
4.9.147-ti-r120
4.9.147-ti-rt-r120
4.14.108-ti-r103
4.14.108-ti-rt-r103
4.14.108-ti-xenomai-r103

Will be tackling 4.19.x and all bone kernels today... Should have all "latest" kernel supporting this by the weekend..

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants