Adding mcp23017; confused by webconf numbers

#1

Heya!
I have a diy zynthian running following hardware:
pi 3B
hifiberry dac+ knockoff
pi official 7inch touchscreen

I started of from a gorgona image and performed zynthain upgrade through the menu.

Everything is working great ! The touchscreen ‘controls’ work ok, but I decided I wanted rotary controllers too. I got a mcp23017 and 4(0) banggood rotary controllers (teensy midi project upcoming). I do seem to have some problems configuring this setup; i2cdetect discovers my mcp23017 at address 0x20 but none of the configs I found in the wiki seem to work.

Can someone tell me where I find more info on what values to enter in the webconf for encoder A pins / encoder B pins / switches? examples seem to suggest 4 values separated by comma & all seem to be above 100, but can’t seem to find any documentation regarding this. Any help would be greatly appreciated.

EDIT: don’t know if it helps, but selecting any of the MCP23017 wiring schemes from the dropdown, makes zynthian gui display the error splashscreen.

#2

You just have to select the mcp23017 option.
It seems to be a different issue. Get the logs during startup, so that we know the error message.

#3

@mheidt I’m ashamed to say I don’t know where to find the zynthian logs.
I see nothing under /var/log …

EDIT: and when you say mcp23017, which one do you mean ?
mcp23017 zynscreen
mcp23017 extra
mcp23017 encoders

EDIT2: to be complete, this is how I wired and configured it:

mcp23017 port A0 GPIO 100 rot1a (encoder1, pin A)
mcp23017 port A1 GPIO 101 rot1b (encoder1, pin B)
mcp23017 port A2 GPIO 102 rot1c (encoder1 switch, pin C)
mcp23017 port A3 GPIO 103 rot2a (encoder2, pin A)
mcp23017 port A4 GPIO 104 rot2b (encoder2, pin B)
mcp23017 port A5 GPIO 105 rot2c (encoder2 switch, pin C)
mcp23017 port A6 GPIO 106
mcp23017 port A7 GPIO 107

mcp23017 port B0 GPIO 108 rot3a (encoder3, pin A)
mcp23017 port B0 GPIO 109 rot3b (encoder3, pin B)
mcp23017 port B0 GPIO 110 rot3c (encoder3 switch, pin C)
mcp23017 port B0 GPIO 111 rot4a (encoder4, pin A)
mcp23017 port B0 GPIO 112 rot4b (encoder4, pin B)
mcp23017 port B0 GPIO 113 rot4c (encoder 4 switch, pin C)
mcp23017 port B0 GPIO 114
mcp23017 port B0 GPIO 115

encoderA
100,103,108,111

encoderB
101,104,109,112

encoderSWITCH
102,105,110,113

#4

EDIT: I had to ctrl+c because it keeps looping the same.
I believe the line “wiringPiISR: pin must be 0-63 (111)” is the error ?!

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.26-v7+ armv7l Raspbian
Current Operating System: Linux zynthian 4.18.7-v7+ #1 SMP Fri Sep 14 08:48:48 CEST 2018 armv7l
Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Build Date: 11 November 2016 11:59:59AM
xorg-server 2:1.18.4-2+rpi1 (https://www.debian.org/support)
Current version of pixman: 0.33.3
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (–) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: “/var/log/Xorg.0.log”, Time: Sat Apr 20 18:25:45 2019
(==) Using config directory: “/etc/X11/xorg.conf.d”
(==) Using system config directory “/usr/share/X11/xorg.conf.d”
INFO:root:No Wiring Layout configured. Only touch interface is available.
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
DEBUG:root:ZCTRL ‘Layer’: 0 (0 -> 7), None, None
wiringPiISR: pin must be 0-63 (111)
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
PNG file: /zynthian/config/img/zynthian_logo_error_ip.png - Application must supply a known background gamma
/zynthian/config/img/zynthian_logo_error_ip.png is 320x240 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4545
Zooming image by 200%…done
didn’t find evidence of prior run.
Merging…done
Building XImage…done
INFO:root:No Wiring Layout configured. Only touch interface is available.
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
DEBUG:root:ZCTRL ‘Layer’: 0 (0 -> 7), None, None
wiringPiISR: pin must be 0-63 (111)
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
PNG file: /zynthian/config/img/zynthian_logo_error_ip.png - Application must supply a known background gamma
/zynthian/config/img/zynthian_logo_error_ip.png is 320x240 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4545
Zooming image by 200%…done
Merging…done
Building XImage…done
INFO:root:No Wiring Layout configured. Only touch interface is available.
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
DEBUG:root:ZCTRL ‘Layer’: 0 (0 -> 7), None, None
wiringPiISR: pin must be 0-63 (111)
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
PNG file: /zynthian/config/img/zynthian_logo_error_ip.png - Application must supply a known background gamma
/zynthian/config/img/zynthian_logo_error_ip.png is 320x240 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4545
Zooming image by 200%…done
Merging…done
Building XImage…done
INFO:root:No Wiring Layout configured. Only touch interface is available.
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
DEBUG:root:ZCTRL ‘Layer’: 0 (0 -> 7), None, None
wiringPiISR: pin must be 0-63 (111)
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
PNG file: /zynthian/config/img/zynthian_logo_error_ip.png - Application must supply a known background gamma
/zynthian/config/img/zynthian_logo_error_ip.png is 320x240 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4545
Zooming image by 200%…done
Merging…done
Building XImage…done

xinit: connection to X server lost

waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.

xinit: unexpected signal 2
root@zynthian:/zynthian/zynthian-ui/doc#

#5

I rather wonder about that.

And that’s all about the logs…you found it.
http://wiki.zynthian.org/index.php/Command_Line_User_Guide

Switches and Extra should work. Use extra if you want to use extra switches like Panic button

#6

I changed the layout multiple times, to see if it would make a difference; I guess the logs above are when I selected dummies or custom.
I changed the layout to MCP23017_encoders; which gives me following logs (still error splashscreen and the logs keep repeating themselves):

INFO:root:Wiring Layout MCP23017_ENCODERS
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
DEBUG:root:ZCTRL ‘Layer’: 0 (0 -> 7), None, None
wiringPiISR: pin must be 0-63 (111)
/zynthian/config/img/zynthian_logo_error_ip.png is 320x240 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4545
PNG file: /zynthian/config/img/zynthian_logo_error_ip.png - Application must supply a known background gamma
Zooming image by 200%…done
Merging…done
Building XImage…done
INFO:root:Wiring Layout MCP23017_ENCODERS
DEBUG:root:ZYNCODER A: [100, 103, 108, 111]
DEBUG:root:ZYNCODER B: [101, 104, 109, 112]
DEBUG:root:SWITCHES layout: [102, 105, 110, 113]
WARNING:root:Using default DISABLED MIDI IN ports
DEBUG:root:ENABLED_MIDI_OUT = [‘ttymidi:MIDI_out’, ‘QmidiNet:in_1’]
WARNING:root:Using default ENABLED MIDI FB ports
Zyncoder: Zynswitches poll thread created successfully
ZynMidiRouter: MIDI tuning frequency set to 440 Hz (8192)
INFO:root:ZYNSWITCHES INIT…
INFO:root:SETUP ZYNSWITCH 0 => wpGPIO 102
INFO:root:SETUP ZYNSWITCH 1 => wpGPIO 105
INFO:root:SETUP ZYNSWITCH 2 => wpGPIO 110
INFO:root:SETUP ZYNSWITCH 3 => wpGPIO 113
INFO:root:ZYNTHIAN-UI OSC server running in port 1370
INFO:root:STOPPING QMIDINET
^Cxinit: connection to X server lost

#7

tried to recompile / upgrade zyncoder kept giving me seg faults and git kept telling me about missing blobs, so I scratched gorgona and installed the new stretch build.

Suspecting my (confirmed) shit encoders, I connected simple buttons to all the relevant pins on the mcp23017 and ground and I got 4 working buttons! 8 if I wire up the unused ones on the mcp23017.

Checking further, it appears my banggood encoders don’t have a broken out switch pin… and the broken out A and B pins seem to mess up the ISR in such a way that everything stops working… Going to try and bypass the encoder PCB’s and solder directly to the encoder pins. Anybody seen anything like this ?!

#8

I have a petting zoo of peculiar encoder wirings if you’d like to present it. . .

I’ve seen less chaotic random number generators…:smiley: