Using two MCP23S17 I/O expanders via SPI1 with CS0 P9.28 and CS1 P9.42. I am initializing each chip separately and doing a read immediately after, which produces the expected data. However, if I go back to read the first chip after initializing the second chip, the data is skewed and doesn't read the first chip correctly. This happens even if I swap the order that the chips are initialized -- whichever one was initialized first ends up with skewed data.
Software or kernel issue? Here is my code and the output: https://pastebin.com/L6qJGwPZ debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh > [sudo] password for debian: > git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7] > eeprom:[A335BNLTEIA04218BBBK0D06] > model:[TI_AM335x_BeagleBone_Black] > dogtag:[BeagleBoard.org Debian Image 2018-10-07] > bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot > 2018.09-00002-g0b54a51eee]:[l > ocation: dd MBR] > kernel:[4.19.59-ti-rt-r25] > nodejs:[v6.14.4] > uboot_overlay_options:[enable_uboot_overlays=1] > > uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-SPIDEV1-00A0.dtbo] > 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-RPROC-4-19-TI- > > 00A0.dtbo] > uboot_overlay_options:[enable_uboot_cape_universal=1] > pkg check: to individually upgrade run: [sudo apt install --only-upgrade > <pkg>] > pkg:[bb-cape-overlays]:[4.4.20190812.0-0rcnee0~stretch+20190812] > pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517] > pkg:[kmod]:[23-2rcnee1~stretch+20171005] > pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005] > pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328] > groups:[debian : debian adm kmem dialout cdrom floppy audio dip video > plugdev us ers systemd-journal i2c > bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk > weston-launch xenomai] > cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 > root=/dev/m mcblk1p1 ro > rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] > dmesg | grep pinctrl-single > [ 1.404225] pinctrl-single 44e10800.pinmux: 142 pins, size 568 > dmesg | grep gpio-of-helper > [ 1.428047] gpio-of-helper ocp:cape-universal: ready > END debian@beaglebone:~/bb.org-overlays/src/arm$ cat BB-SPIDEV1-00A0.dts /* * Copyright (C) 2013 CircuitCo * * Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ /dts-v1/; /plugin/; #include <dt-bindings/board/am335x-bbw-bbb-base.h> #include <dt-bindings/pinctrl/am33xx.h> / { compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; /* identification */ part-number = "BB-SPIDEV1"; version = "00A0"; /* state the resources this cape uses */ exclusive-use = /* the pin header uses */ "P9.31", /* spi1_sclk */ "P9.29", /* spi1_d0 */ "P9.30", /* spi1_d1 */ "P9.28", /* spi1_cs0 */ "P9.42", /* spi1_cs1 */ /* the hardware ip uses */ "spi1"; /* * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ */ fragment@0 { target-path="/"; __overlay__ { chosen { overlays { BB-SPIDEV1-00A0 = __TIMESTAMP__; }; }; }; }; /* * Free up the pins used by the cape from the pinmux helpers. */ fragment@1 { target = <&ocp>; __overlay__ { P9_28_pinmux { status = "disabled"; }; /* spi1_cs0 */ P9_30_pinmux { status = "disabled"; }; /* spi1_d0 */ P9_29_pinmux { status = "disabled"; }; /* spi1_d1 */ P9_31_pinmux { status = "disabled"; }; /* spi1_sclk */ P9_42_pinmux { status = "disabled"; }; /* spi1_cs1 */ }; }; fragment@2 { target = <&am33xx_pinmux>; __overlay__ { /* default state has all gpios released and mode set to uart1 */ bb_spi1_pins: pinmux_bb_spi1_pins { pinctrl-single,pins = < 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ 0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ 0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */ 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ 0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */ >; }; }; }; fragment@3 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&bb_spi1_pins>; ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits... */ num-cs = <2>; //cs-gpios = <0>, <1>; channel@0 { #address-cells = <1>; #size-cells = <0>; compatible = "spidev"; symlink = "spi/1.0"; reg = <0>; spi-max-frequency = <16000000>; spi-cpha; }; channel@1 { #address-cells = <1>; #size-cells = <0>; compatible = "spidev"; symlink = "spi/1.1"; reg = <1>; spi-max-frequency = <16000000>; //spi-cpha; }; }; }; }; -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/b01f2bae-b1f8-4296-a2cd-e3dcc5bbf760%40googlegroups.com.
