hzeller / beagleg

G-code interpreter and stepmotor controller for crazy fast coordinated moves of up to 8 steppers. Uses the Programmable Realtime Unit (PRU) of the Beaglebone.
http://beagleg.org/
GNU General Public License v3.0
122 stars 50 forks source link

Attempted beagleg-cape-pinmux.sh #1

Closed MantisClone closed 10 years ago

MantisClone commented 10 years ago

Pin display loop only displays pin 0. I changed $SLOTS to have bone_capemgr.8 because I couldn't find .9 on my board. I'm unsure if the overlay actually changed the pin modes. Output is shown below.

I'm very interested in your work by the way. Is it okay if I come to you with specific questions about the code if they come up?

root@beaglebone:~/Desktop/beagleg# bash -x ./beagleg-cape-pinmux.sh > templog.txt
+ BIN_DTB=BeagleG-00A0.dtbo
+ '[' '!' -e BeagleG-00A0.dtbo ']'
+ PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ SLOTS=/sys/devices/bone_capemgr.8/slots
++ grep 0x
++ awk '{printf("%03x\n", $1 + 2048);}'
++ cat BeagleG.dts
+ OFFSETS_800='800
800
800
800
800
800
800
800
800
800
800
800
800
800
800
800
800'
+ echo 'This is how these pins look before.'
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ cp BeagleG-00A0.dtbo /lib/firmware
+ echo
+ echo 'Adding BeagleG overlay'
+ echo BeagleG
+ cat /sys/devices/bone_capemgr.8/slots
+ echo
+ echo 'This is how these pins look afterwards'
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
+ for f in '$OFFSETS_800'
+ grep 800 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
root@beaglebone:~/Desktop/beagleg# 
hzeller commented 10 years ago

mmh, maybe this has to do with the kernel version ? What is your kernel version ? I read that at some point the way the pinmuxing is done was changed.

You can see if things are working if the Z-axis outputs steps. X and Y are working just with the default configuration, but Z (and possibly others) require the device overlay.

When I come home tonight, I'll check out my kernel version. Also the 800 output looks kindof strange. Can you replace 'awk' with 'gawk' in the script and see if this makes a difference ?

And yeah, you can of course ask questions.

hzeller commented 10 years ago

Ah, I just played with this on my workstation, looks like gawk actually might behaving different than the script expects. Can you replace 'awk' with /usr/bin/mawk and see if that fixes it ?

MantisClone commented 10 years ago

I used

uname -r

and it found my kernel version is 3.8.13. I'll also say that I'm fairly new to linux and embedded programming so I'm new to using grep and awk and regex. I tried mawk as you said and it wasn't found so I'm assuming I need to install it still. I'll be working on it a bit more tomorrow.

hzeller commented 10 years ago

Can you try again ? I've now removed one implicit assumption about awk being able to parse hex numbers.

hzeller commented 10 years ago

For reference, my kernel is 3.8.13-bone28

MantisClone commented 10 years ago

I think it worked.

My output looks like this:

root@beaglebone:~/Desktop/beagleg# ./beagleg-cape-pinmux.sh
This is how these pins look before.
pin 84 (44e10950) 00000037 pinctrl-single
pin 85 (44e10954) 00000037 pinctrl-single
pin 86 (44e10958) 00000062 pinctrl-single
pin 87 (44e1095c) 00000062 pinctrl-single
pin 89 (44e10964) 00000027 pinctrl-single
pin 96 (44e10980) 00000037 pinctrl-single
pin 97 (44e10984) 00000037 pinctrl-single
pin 109 (44e109b4) 00000027 pinctrl-single
pin 12 (44e10830) 00000027 pinctrl-single
pin 13 (44e10834) 00000027 pinctrl-single
pin 14 (44e10838) 00000027 pinctrl-single
pin 15 (44e1083c) 00000027 pinctrl-single
pin 16 (44e10840) 00000027 pinctrl-single
pin 17 (44e10844) 00000027 pinctrl-single
pin 18 (44e10848) 00000027 pinctrl-single
pin 19 (44e1084c) 00000027 pinctrl-single
pin 30 (44e10878) 00000037 pinctrl-single

Adding BeagleG overlay
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BeagleG

This is how these pins look afterwards. They should all have mode 00000007
pin 84 (44e10950) 00000007 pinctrl-single
pin 85 (44e10954) 00000007 pinctrl-single
pin 86 (44e10958) 00000007 pinctrl-single
pin 87 (44e1095c) 00000007 pinctrl-single
pin 89 (44e10964) 00000007 pinctrl-single
pin 96 (44e10980) 00000007 pinctrl-single
pin 97 (44e10984) 00000007 pinctrl-single
pin 109 (44e109b4) 00000007 pinctrl-single
pin 12 (44e10830) 00000007 pinctrl-single
pin 13 (44e10834) 00000007 pinctrl-single
pin 14 (44e10838) 00000007 pinctrl-single
pin 15 (44e1083c) 00000007 pinctrl-single
pin 16 (44e10840) 00000007 pinctrl-single
pin 17 (44e10844) 00000007 pinctrl-single
pin 18 (44e10848) 00000007 pinctrl-single
pin 19 (44e1084c) 00000007 pinctrl-single
pin 30 (44e10878) 00000007 pinctrl-single
root@beaglebone:~/Desktop/beagleg#

And also, I think I've finally figured out what the value of your OFFSETS_800 variable is. That's a tough line to figure out, but it's basically taking your device tree overlay file, taking only the lines with hex numbers (0x) in them, parsing out the first of the two arguments on each line (the offset). You then format that offset into the form 44e10<offset +2048> and store it to OFFSETS_800. If there's anything glaringly wrong with that previous description let me know.

hzeller commented 10 years ago

Yes. Also I add 0x800 (2048) to it to give the full address. All of these things are not really needed in this script, as only copy the binary file to /lib/firmware and echo "BeagleG" > $SLOTS is necessary. The offset thing is just as a way to look at the PINS and see if their modes changed.

Glad it now works on your board.