Thank you.
I will check that also.
Maybe on top of the configuration problems there is some strange behavior of the MCP23017.
But I’ll check that in detail, maybe by disconnecting this unit and checking it separately with a small Program on a Raspi Pico (so I don’t mess up with Zynthian)
What does webconf display for the current wiring selection?
A screen shot helps.
Stick -1 in for the two failing pins on Wiring Switches
export ZYNTHIAN_WIRING_SWITCHES=“-1, -1, 100, 103”
I find this sort of stuff easier from webconf but stick with the method that works for you.
I think that GPA presents as pins 100..107 and GPB presents as pins 108..115.
You have missed out pin 111.
You have not marked up on your drawing where the interupt pins are wired.
There are spaces in the lists, try removing them.
Normally I document my things on my very old fashioned and incomplete homepage
or on Github
But this time I struggled so much to get a start that I have a lot of notes spreaded on my table that are not ready. I hope they will get better with the time.
I did it (from the web config, normally I do but I thought text would be a bit more compact to post)
and the result is this now:
Dec 28 12:07:06 zynthian startx[2389]: ZynCore->setup_behaviour_zyncoder(2, ...): Invalid index!
Dec 28 12:07:06 zynthian startx[2389]: ZynCore->setup_behaviour_zyncoder(3, ...): Invalid index!
Dec 28 12:07:06 zynthian startx[2389]: ZynCore->setup_behaviour_zyncoder(0, ...): Invalid index!
Dec 28 12:07:06 zynthian startx[2389]: ZynCore->setup_behaviour_zyncoder(1, ...): Invalid index!
Dec 28 12:07:06 zynthian startx[2389]: ZynCore->setup_behaviour_zyncoder(2, ...): Invalid index!
If I manually enter your config at the command line it fails because of the spaces in the lists:
(venv) root@zynthian-rpi5:/zynthian/zynthian-ui# export ZYNTHIAN_WIRING_ENCODER_A=“110, 114, 102, 105”
bash: export: `114,': not a valid identifier
bash: export: `102,': not a valid identifier
bash: export: `105”': not a valid identifier
Oh no, you are right!
With all this messing around, I cannot count anymore!
I have corrected the schematic I posted.
Also, entering at the command line, you must omit the quote marks, e.g.
export ZYNTHIAN_WIRING_ENCODER_A=110,114,102,105
I have started to document my experiments:
There is a description of
- my first try without any decoders or buttons (success!)
- a test I did using a Raspi Pico connected to my encoder board via I2C.
This test revealed that the hardware is functional.
The Zynthian configuration problem is still the same.
Oops, I just noticed another error in my schematic. I switched Port A and port B addresses as I instinctively thought A is on top and B on the bottom.
One should really doublecheck everything.
But this cannot be the source of the errors at it would just switch the encoders.
Should I edit my post above and post a corrected schematic?
Here is a screenshot of my actual configuration:
Question: is there anything else to do at the bottom of this config screen (customizng the switches for intended action)? I did not do anything else as I thought the 4 encoders had a standard function.
If I were you, I’d simply build it according to the official schematic (see PDF below).
I just finished a diy zynthian, and the encoders worked out of the box. No config changes necessary.
Please look at the MCP23017 left bottom. It has I2C number 0x21, not 0x20 as you describe.
Also the switches are on ports A0 - A3, not scattered all over the place.
If you use the correct rotary encoders (as already emphasized by @wyleu) and you connect them as in the schematic it simply works. Please do yourself a favour and stop messing with the config.
Kind regards,
Hans.
V5 control.pdf (78.4 KB)
Thank you for your reaction.
I sort of expected that someone would tell me: “Why don’t you buy the kit and everything will work fine.”
Well, I’m used to developing things by starting small and adding features on the way forward.
I will however come back to your proposal, maybe.
Concerning the encoders: I cannot imagine that they are the problem. I have used them in other circuits, if Vcc and GND are connected there should be no problem. And how should the software know if they work fine or not while not being activated. The error must come from bad configuration, and I would really like to know what’s wrong.
”Also the switches are on ports A0 - A3, not scattered all over the place.”
Yes, I would have arranged them also in a more ordered way, but I started from the schematic of Zynthian mini, not knowing if it was allowed to put them in a different way.
At the beginning there were too many confusing things, like the use of Wiring Pi numbers. It took me some time for example to check out where the interrupts were connected, as the pin numbers did not match the GPIOs on my Raspi.
Anyway, Zynthian is a super project and I would like to go on with it!
Hi @Jean-Claude_Feltes !
Do you know there is a command line tool to test encoders and switches?
It’s in the zyncoder’s library build dir:
/zynthian/zyncoder/build/zyncoder_test
To use it, you must be sure that zynthian service is stopped:
systemctl stop zynthian
You will find this tool very useful to test your wiring config and trace the issues.
Also, i would recommend you to edit & test the wiring config from command line. It’s a lot faster!
0. Stop zynthian service and work from zyncoder’s library dir:
systemctl stop zynthian
cd /zynthian/zyncoder
1. Edit the configuration in /zynthian/config/zynthian_envars.sh. For instance:
joe /zynthian/config/zynthian_envars.sh
2. Load the new config with:
source /zynthian/config/zynthian_envars.sh
Probably this step is not needed, but it won’t harm ![]()
3. Rebuild the library:
rm -rf build
./build.sh
4. Test the configuration with the command line tool:
./build/zyncoder_test
Iterate from 1 …
All the best,
Thank you Joe,
that seems a very interesting method to test my hardware.
I will try it.
But what I still miss is an information on the rules that are valid for the config.
Is there no place where this info can be read. For example it was not evident for me to know that the ports of the MCP23017 have addresses 100, 101, … and not 0, 1, 2 …
Concerning the command line: yes, I like it, and I have used one or the other method to enter my config.
It is very good that files can be edited with the web config.
There are no general fixed rules for wiring config, as they depend of the zyncontrol file used to build zyncoder. In your case, it’s the “zyncontrol_vx.c” file and the rules are hardcoded on it. It’s not too difficult to read and understand:
Regards,
BTW, after refreshing my mind with the code, i see you could simplify the testing procedure:
0. Stop zynthian service and work from zyncoder’s library dir:
systemctl stop zynthian
cd /zynthian/zyncoder
1. Edit the configuration in /zynthian/config/zynthian_envars.sh. For instance:
joe /zynthian/config/zynthian_envars.sh
2. Load the new config with:
source /zynthian/config/zynthian_envars.sh
3. Test the configuration with the command line tool:
./build/zyncoder_test
Iterate from 1 …
Ah! That should help me a lot! Thank you!
I will study the code and experiment further…
Other than sending the boys round, I’m not sure how we would enforce this, and if we did I would expect it to end up as a jam session . . .
When I do the test I get this:
root@zynthian://zynthian/zynthian-ui/zyncoder# systemctl stop zynthian
root@zynthian://zynthian/zynthian-ui/zyncoder# cd /zynthian/zyncoder
root@zynthian:/zynthian/zyncoder# source /zynthian/config/zynthian_envars.sh
root@zynthian:/zynthian/zyncoder# ./build/zyncoder_test
Starting ZynCore...
ZynCore: Configured 0 x Logical Zynswitches...
ZynCore: Setting-up 0 x Physical Zynswitches...
ZynCore: Setting-up zyncoder in pins (102, 101)...
ZynCore: Setting-up zyncoder in pins (105, 104)...
ZynCore: Setting-up zyncoder in pins (110, 109)...
ZynCore: Setting-up zyncoder in pins (113, 112)...
ZynCore: Setting-up 4 x Zynpots (zyncoders)...
ZynCore->init_poll_zynswitches(): Zynswitches poll thread created successfully
ZynCore->setup_behaviour_zyncoder(0, ...): Invalid index!
ZynCore->setup_behaviour_zyncoder(1, ...): Invalid index!
ZynCore->setup_behaviour_zyncoder(2, ...): Invalid index!
ZynCore->setup_behaviour_zyncoder(3, ...): Invalid index!
Testing switches & rotaries...
(I left away the encoder switches for the test)
It seems that the proble does not lie in the piece of code that you gave me, as there is no such text to be found.
Could you give me an idea where to lokk further?
