Encoder Settings killing Zynthian software?

Hi guys,

first of all: thank you for a great project and a great forum accompanying it.
Before I decide to buy a unit, I meant to try building a screenless one with a raspi 3B+ and an audioinjector card.

Here’s what I encountered 5+ times:
After configuring HDMI and sound via webconf the unit works as expected, UI is displayed via HDMI, sound works, Midi via USB and UART is fine.

Here’s the catch:
When I configure hardware GPIOs (no multiplexer IC) for a rotary encoder and reboot, Zynthian doesn’t start anymore. Stopping and restarting Zynthian via PuTTY (as described in the Wiki ) doesn’t do anything. Same for webconf. This behaviour occured with several different pin-configurations (yes, I Ieft out the preoccupied pins for I2S, UART etc.).

Is this a known bug, maybe with the latest version? Did anybody try encoders connectet directly to GPIOs lately?

Thank you so much for your help!

1 Like

Hi, welcome.
I understand that the pi starts as you can log in through ssh, but the zynthian ui doesn’t start. I didn’t understand if webconf is running or not.
You have made a custom encoders wiring, by connecting them directly to the GPIO. You have to configure that custom wiring through the webconf. Have you done this ?

You can get a verbose zynthian startup by “restarting” the UI in debug mode from the webconf. Maybe you will get some usefull informations.

Thanks for your reply, le51

I forgot to mention:
Yes, I configured the custom wiring in webconf.

Once this is done and I reboot, neither the zynthian UI nor the webconf work anymore, only SSH. And both can’t be startet via SSH.

Is there a possibility to change the settings normally made in webconf (wiring etc.) via SSH, too?
This would save some time as of now I have to re-etch a SD card everytime.

It’s curious that webconf doesn’t work anymore. Is your SD updated to the last?

Yes. Simply edit this file:

/zynthian/config/zynthian_envars.sh

and run this command after saving the changes:

# zynthian_update_sys.sh

Regards

2 Likes

I don’t know.

You can check with:

journalctl -u zynthian-webconf -f

and

journalctl -u zynthian -f

if you can get any valuable debug messages.
Otherwise, you may:
Stop zynthian and zynthian-webconf:

systemctl stop zynthian-webconf
systemctl stop zynthian

and then start them “by hand”:

/zynthian/zynthian-ui/zynthian.sh
/zynthian/zynthian-webconf/zynthian_webconf.sh

and see what comes out !

1 Like

Hi jofemodo,

yes, I updated both the OS and Zynthian.

Thank you, I will try that and report back.

For the UI, you can omit the full path and use only the script name like that:

zynthian.sh

For the webconf, i think you have to be on the directory, like that:

cd /zynthian/zynthian-webconf
./zynthian_webconf.sh

Regards,

You shouldn’t update the OS. It could break things …

Regards,

I’ve missed that. Thanks

Great, thanks! That’s kind of interesting.: after setting all the encoder-pins to “0” via SSH and rebooting, webconf does work again.
Curiously, when I click on hardware - audio, there is an error:
“500: Internal Server Error” all the other pages of the webconf menu work. I am beginning to wonder whether there is something wrong with my audio hardware…

coincidence? i think not…

I also have error 500 on the same page after update.

connected to this error maybe…

Feb 10 20:45:50 zynthian startx[526]: ERROR:zynthian_gui.init_midi: ERROR initializing MIDI : ‘NoneType’ object has no attribute ‘set_midi_filter_tuning_freq’

??

for the record… behringer usb soundcard… has no on board midi… in case that may explain?

It looks like something is broken elsewhere:

Sorry guys! I can’t reproduce the problem and i tried to burn a fresh SD and update, but nothing. Everything works OK on my zynthians. Have you tried to update again and reboot?

Regards,

I just burned a new SD card myself and will try it ASAP.
Updating Zynthian, but not the OS :slight_smile:

Thank you so much for your help guys.

just tried doing this… something changed… I can now see my sound card settings but my zynth screen is still ERROR

1 Like

I just updated and now get the ERROR screen. I’m using my zynthian with 7" rpi touchscreen, no encoders and rbpi headphones on RPI4. Also noticed the same error as MrBroccoli reported: ERROR:zynthian_gui.init_midi: ERROR initializing MIDI : ‘NoneType’ object has no attribute ‘set_midi_filter_tuning_freq’

So I grabbed another sd card and burned a new image Build Date: 2020-09-05. Booted, changed settings and Zynthian was working fine. I should mention when audio is set to rbpi headphones in webconf, I get the ERROR screen, but when I change settings to Hifiberry dac+ Light everything works. So I do a software update from webconf and just like the other sd card, the ERROR screen returns. Here’s the UI log:
– Logs begin at Thu 2021-02-11 05:10:27 GMT. –
Feb 11 05:46:42 zynthian startx[459]: screen_obj.hide();
Feb 11 05:46:42 zynthian startx[459]: File “/home/pi/zynthian-ui/zyngui/zynthian_gui_midi_key_range.py”, line 275, in hide
Feb 11 05:46:42 zynthian startx[459]: zyncoder.lib_zyncoder.set_midi_learning_mode(0)
Feb 11 05:46:42 zynthian startx[459]: AttributeError: ‘NoneType’ object has no attribute ‘set_midi_learning_mode’
Feb 11 05:46:43 zynthian startx[459]: zynseq exit
Feb 11 05:46:43 zynthian startx[459]: PNG file: /zynthian/config/img/fb_zynthian_error_ip.png - Application must supply a known background gamma
Feb 11 05:46:43 zynthian startx[459]: /zynthian/config/img/fb_zynthian_error_ip.png is 800x480 PNG image, color type RGB_ALPHA, 8 bit, file gamma 0.4546
Feb 11 05:46:43 zynthian startx[459]: Zooming image by 100%…done
Feb 11 05:46:43 zynthian startx[459]: Merging…done
Feb 11 05:46:43 zynthian startx[459]: Building XImage…done
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): warning: Replacing version 2071.7 of http://gareus.org/oss/lv2/b_whirl#extended from <file:///zynthian/zynthian-plugins/lv2/b_whirl.lv2/>
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): note: New version 2071.11 found in <file:///zynthian/zynthian-plugins/lv2/b_whirl/>
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): warning: Replacing version 2071.7 of http://gareus.org/oss/lv2/b_whirl#simple from <file:///zynthian/zynthian-plugins/lv2/b_whirl.lv2/>
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): note: New version 2071.11 found in <file:///zynthian/zynthian-plugins/lv2/b_whirl/>
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): warning: Ignoring bundle <file:///zynthian/zynthian-plugins/lv2/b_synth.lv2/>
Feb 11 05:46:48 zynthian startx[459]: lilv_world_load_bundle(): note: Newer version of http://gareus.org/oss/lv2/b_synth loaded from <file:///zynthian/zynthian-plugins/lv2/b_synth/>
Feb 11 05:46:55 zynthian startx[459]: libjackpeak registering as ‘jackpeak’.
Feb 11 05:46:55 zynthian startx[459]: libjackpeak created input ports
Feb 11 05:46:56 zynthian startx[459]: ERROR: PatternManager failed to open file for load /zynthian/zynthian-my-data/sequences/patterns.zynseq
Feb 11 05:47:00 zynthian startx[459]: WARNING:zynthian_autoconnect.cb_jack_xrun: Jack Audio XRUN!
Feb 11 05:47:00 zynthian startx[459]: ERROR:zynthian_gui.init_midi: ERROR initializing MIDI : ‘NoneType’ object has no attribute ‘set_midi_filter_tuning_freq’
Feb 11 05:47:00 zynthian startx[459]: WARNING:zynthian_autoconnect.cb_jack_xrun: Jack Audio XRUN!
Feb 11 05:47:00 zynthian startx[459]: WARNING:zynthian_autoconnect.cb_jack_xrun: Jack Audio XRUN!
Feb 11 05:47:00 zynthian startx[459]: WARNING:zynthian_autoconnect.cb_jack_xrun: Jack Audio XRUN!
Feb 11 05:47:01 zynthian startx[459]: Can’t init zyncoder library: /home/pi/zyncoder/build/libzyncoder.so: undefined symbol: zyncoder_mcp23017_bankA_ISR
Feb 11 05:47:01 zynthian startx[459]: zynseq: Jack samplerate: 44100
Feb 11 05:47:01 zynthian startx[459]: zynseq: Jack buffer size: 512
Feb 11 05:47:01 zynthian startx[459]: Traceback (most recent call last):
Feb 11 05:47:01 zynthian startx[459]: File “./zynthian_gui.py”, line 1701, in
Feb 11 05:47:01 zynthian startx[459]: zyngui.start()
Feb 11 05:47:01 zynthian startx[459]: File “./zynthian_gui.py”, line 373, in start
Feb 11 05:47:01 zynthian startx[459]: self.show_screen(‘main’)
Feb 11 05:47:01 zynthian startx[459]: File “./zynthian_gui.py”, line 418, in show_screen
Feb 11 05:47:01 zynthian startx[459]: self.hide_screens(exclude=screen)
Feb 11 05:47:01 zynthian startx[459]: File “./zynthian_gui.py”, line 404, in hide_screens
Feb 11 05:47:01 zynthian startx[459]: screen_obj.hide();
Feb 11 05:47:01 zynthian startx[459]: File "/home/pi/zynthian-

Looks to me like the latest commit on zyncoder.c has an error in the #ifdef logic, that causes the zyncoder_mcp23017_bankA_ISR function to be referenced, but not defined when using anything else than MCP23008_ENCODERS or MCP23017_ENCODERS:

The functions are embedded in this IFDEF:

#ifdef MCP23017_ENCODERS
// wiringpi node structure for direct access to the mcp23017
struct wiringPiNodeStruct *zyncoder_mcp23017_node;

// two ISR routines for the two banks
void zyncoder_mcp23017_bankA_ISR() {
	zyncoder_mcp23017_ISR(zyncoder_mcp23017_node, MCP23017_BASE_PIN, 0);
}
void zyncoder_mcp23017_bankB_ISR() {
	zyncoder_mcp23017_ISR(zyncoder_mcp23017_node, MCP23017_BASE_PIN, 1);
}
void (*zyncoder_mcp23017_bank_ISRs[2])={
	zyncoder_mcp23017_bankA_ISR,
	zyncoder_mcp23017_bankB_ISR
};
#endif

but the logic that decides when to reference them is different:

#ifdef MCP23008_ENCODERS
		if (pin<MCP23008_BASE_PIN) {
			wiringPiISR(pin,INT_EDGE_BOTH, update_zynswitch_funcs[i]);
			update_zynswitch(i);
		}
#else
		// this is a bit brute force, but update all the banks
		zyncoder_mcp23017_bankA_ISR();
		zyncoder_mcp23017_bankB_ISR();
#endif

So, when choosing DUMMY_ENCODERS in the webconf, I assume the library will be recompiled and then failing because of a reference to a function that doesn’t exist:

(from zyncoder/CMakeLists.txt at master · zynthian/zyncoder · GitHub):

if (("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "MCP23017_ENCODERS") 
 OR ("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "MCP23017_EXTRA")
 OR ("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "MCP23017_ZynScreen")
 OR ("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "MCP23017_EPDF")
 OR ("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "MCP23017_EPDF_REVERSE"))
	message("++ Defined MCP23017_ENCODERS")
	add_definitions(-DMCP23017_ENCODERS)
elseif(NOT ("$ENV{ZYNTHIAN_WIRING_LAYOUT}" STREQUAL "DUMMIES"))
	message("++ Defined MCP23008_ENCODERS")
	add_definitions(-DMCP23008_ENCODERS)
else()
	message("++ Defined DUMMY_ENCODERS")
	add_definitions(-DDUMMY_ENCODERS)
endif()
2 Likes

Sorry guys! I can’t reproduce the problem and i tried to burn a fresh SD and update, but nothing. Everything works OK on my zynthians.

I assume being @jofemodo El Jefe of the Zynthian kits, you will not have a lowly config with dummy inputs/custom encoders :grin:?

1 Like

I think @wyleu reported this in GitHub. We certainly diagnosed this whilst teaching his recent issues with I2C.

1 Like

Excuse my noobness. Do you think, choosing any entry other than “DUMMY_ENCODERS” would be a temporary fix? I was close to giving up, but I’ll try it as soon as I can.

Very inspiring forum :+1:

1 Like