Using Zynaptik module for encoders [SOLVED!]

No luck unfortinately. Rebuilt everything a few times (using build.sh at the end), reverted changes a few times - encoder doesn’t work and webconfig says:
GPIO Expander: Not detected

Inside zynaptik.c file I have changed only the address of MCP23017 (from 0x21 to 0x20).

When it didn’t work, I’ve used some logic and tried to change base pin number to 100 (isn’t it GPB0 on MCP23017 ?) - again no luck. Reverted back.

Tried to connect encoders to as different controls (1, 4) - no luck either.

Somehow MCP23017 seems to be not even initialized.
According to it’s specifications INTA is pin 20 and INTB is pin 19 if I am correct.

Checked all the connections twice with tester - everything seems to be in order.

Tried MCP23017_Extra and MCP23017_Encoders layout for wiring.

Maybe we miss something like extra file include in the code, extra comma or something. Seems to be so close, but yet…

Still looking for solution … :sweat:

UPDATE:

Right now I have discovered, that my MCP23017 on zynaptik is still detected on the address 0x21 even as I have changed it’s address in “/zynthian/zyncoder/zynaptic.c” file to 0x20 (everything compiles and built after changes). Still “i2cdetect -y 1” (same command as ‘gpio i2cd’) shows me it’s address as 21.

Looking for the natural way to change it’s address to 0x20. Some forums says the signal on the pints A0 A1 A2 are respoisible for addressing each MCP23017 if there are several together. Can be up ti eight :slight_smile:

Any ideas how to do it on zynaptik not to burn anything ?

A2 A1 A0 I2c Address
0 0 0 0x20
0 0 1 0x21
0 1 0 0x22
0 1 1 0x23
1 0 0 0x24
1 0 1 0x25
1 1 0 0x26
1 1 1 0x27

p.s. If I connect A0 to the GND it should let it be on address 0x20 technically, but wouldn’t it create short circuit ?

SOLVED !!!

In a very “russian” radical way I might say. There was some current on A0 of MCP23017 (have no idea 5 or 3.3 volts) and I have just cut this contact and immediately webconfig says:

GPIO Expander: MCP23017

I have 2 spare MCP chips so I sacrificed one.

Now zyncoder_test shows activity on connected encoder and I can proceed further.

So for those, who would have similar approach with zynthian to make zynaptik module work as standalone mcp23017 extender as well as analog and digital IO extention, you need to change two things in zynaptik.c:

    #define ZYNAPTIK_MCP23017_I2C_ADDRESS **0x20** (was 0x21) 
    #define ZYNAPTIK_MCP23017_BASE_PIN **100** (was 200)

Then follow the instructions in README.md inside zyncoder folder and rebuild everything (build.sh).

Thanks for great support everyone, especially @jofemodo ! :grinning:

1 Like