Playing with LEDs

49 views
Skip to first unread message

Joel Stanley

unread,
Nov 14, 2017, 9:42:46 AM11/14/17
to linux...@googlegroups.com
I wasn't having any luck talking to the phy over mdio, so I took at
look at blinking leds to make sure something was working. I sent a
patch to the list:

https://groups.google.com/forum/message/raw?msg=linux-litex/qgjYMNgtvkE/08tYK3bzAAAJ

The result should look a bit like this:

https://twitter.com/shenki/status/930432872443297794

To test, add libgpiod tools to your buildroot config:

BR2_PACKAGE_LIBGPIOD=y
BR2_PACKAGE_LIBGPIOD_TOOLS=y

Or grab mine:

wget https://ozlabs.org/~joel/buildroot_litex_defconfig -O configs/

If you've not used buildroot:

git clone git://git.buildroot.net/buildroot
cd buildroot
wget https://ozlabs.org/~joel/buildroot_litex_defconfig -O
configs/litex_defconfig
make litex_defconfig
cp output/images/rootfs.cpio.gz ~/linux/

Apply this patch to the kernel (download the raw version from your
mail software, or the link above):

cd ~/linux/
git remote add shenki https://github.com/shenki/linux
git fetch shenki
git checkout -b litex-4.14 shenki/litex/litex-4.14
git am ~/joels-email.mbox
export ARCH=openrisc
export CROSS_COMPILE=~/buildroot/output/host/bin/or1k-linux-
make litex_defconfig

Copy (or symlink) the binary to your tftp directory:

ln -s arch/openrisc/boot/vmlinux.bin /srv/tftp/boot.bin

Boot it up. You need your tftp sever on 192.168.100.100, and the ethernet cable
connected to the Arty. This assumes you've got the gateware on your Arty.

Welcome to Buildroot
buildroot login: root
# gpioinfo
gpiochip0 - 8 lines:
line 0: "ld4" "arty:green:ld4" output active-high [kernel]
line 1: "ld5" "arty:green:ld5" output active-high [kernel]
line 2: "ld6" unused input active-high
line 3: "ld7" unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high

# gpiofind "ld6"
gpiochip0 2

# gpioset gpiochip0 2=1

# gpioset gpiochip0 2=0

1 is on, 0 is off. You can't request ld4 or ld5 as they are assigned
to the LED driver.

Let me know if you replicate!

Cheers,

Joel
Reply all
Reply to author
Forward
0 new messages