I’ve compiled zyncoder_test, after uncommenting the following section in the main function of the zyncoder_test.c file, and adding one or two more debugging fprintf statements to verify hardware pins.
for (i=0;i<num_zynpots;i++) {
int32_t val = get_value_zynpot(i);
if (val!=0) {
printf("PT-%d = %d\n", i, val);
}
And. Here is the ouput. Basically, no output.
(venv) root@zynthian:/zynthian/zyncoder# systemctl stop zynthian
(venv) root@zynthian:/zynthian/zyncoder# ./build/zyncoder_test
Starting ZynCore...
ZynCore: Configured 4 x Logical Zynswitches...
ZynCore->setup_zynmcp23017(0, ...): setting up I2C device at [i2caddr=20, intA=16, intB=26]
ZynCore->gpiod_line_register_callback(): Registered callback on pin 16
ZynCore->gpiod_line_register_callback(): Registered callback on pin 26
ZynCore: Setting-up 4 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->gpiod_start_callbacks: Callback thread created successfully
number of zynpots... 4
Testing switches & rotaries...
Start with the select encoder switch and trace the switching action right to the pins of the 23017.
I’ve not tried a 23017 with a Pi5 but I’ve had it flying on all other Pi’s. Normally it turns out to be a hardware issue. And that can boil down to the test gear you have available. Just because a software instant declares an interrupt pin doesn’t confirm it’s actually ever received one. And do this with a switch not an encoder because encoders have differing types especially if mounted on a PCB…and.
Looking at the encoder you have pointed to, it’s not the type that is usually used with zynthians.
The zynth assumes that both the direction pins and the encoder centre switch are pulled high on the chip when unused and pulled low by the contact being made. The ones you show adhere more to the Kh004 subsystem which generally works by supplying a positive voltage on switch activation…
Apologies if this is all blindingly obvious, it’s sometimes difficult to know how much people know. IT’s a real pleasure opening up a new area of knowledge for someone especially if they have been pushed here by their own enthusiasm.
hi infinitymodular
I can’t describe in words my suffering until I got these KY-040 to work somehow. First of all, I had to grab a soldering iron and get rid of the pull-up SMD resistors R1-R3. Now, following the advice on the forum, I’m going to solder the capacitors.
Is the MPC being detected by zynthian? It should show in the Hardware section of webconf console (main page). You can also run i2cdetect -y 1 to show the detected device addresses.
funny you should ask… I just spotted that and it’s showing up as 0x27 … so I changed the address. And things are happening now with the encoders and buttons YAY!!!
now I need to check the manual to see if the behaviour is correct.
I had the first encoder switch/enca swapped around… It’s totally working now… Thanks for the assistance everyone! I’m so chuffed with this now … it’s a whole new world… Soon the pushbutton’s should arrive, and then I can start down the road of adding those…