JohSchneider / yamsek.kicad

pcb layouts for the modules used in the YaMseK keyboard
2 stars 0 forks source link

Support Request: QMK firmware for split keyboard with RP2040+MCP23017/18? #1

Open azhizhinov opened 2 months ago

azhizhinov commented 2 months ago

Hello. I've recreated this keyboard from this and tried to port the QMK firmware. Original author of this keyboard has the KMK firmware, but I failed to get the keyboard running. I have almost zero knowledge about C-code, so I've tied to the code form various keyboards with the MCP23017/8 on board with no luck. Left part of this keyboard is working, but can't receive any keycodes from the right part. I've tried to reuse firmware from the Ferris split keyboard, but there are no keycodes from the right half. Thanks in advance.

JohSchneider commented 1 month ago

the left part has the MCU/atmega(?) and the right part is the i2c-ioexpancer=mxp23017? things to check:

azhizhinov commented 1 month ago

Hello. Thanks for your attention. It's the RPi Pico on the left half and MCP23017 on the left. Pullups? Resistor? It's looks like that. изображение I've checked for 3.3V at 9 and 10 pins, it's defenetly there. There ara few firmwares with different MCUs + MCP23017/18, but not for the RP2040 as MCU. I've tried to adopt the Ferris 2.0 firmware, the Torn firmware, Ingrained firmware, but non of them worked in my case. I've scratched my head against the code here, with this code the left half is working with delays between keypresses. I'm not a coder at all, the C code is kind of abracadabra for me. :-) 20240511.SPROW63.00.pdf

azhizhinov commented 1 month ago

All these firmwares are with "print" commands and I can't compile this with "CONSOLE_ENABLE".

JohSchneider commented 1 month ago

I've checked for 3.3V at 9 and 10 pins, it's defenetly there.

3.3V at both pins makes no sense :-D -- pin 9=3.3V, and pin 10= Gnd? so power is ok, signal and pullups probably too? then check it the rpi can talk to the i2c expander - either with an oscilloscope, or a test firmware (see minipirate, or look at qmk_firmware/tree/master/keyboards/handwired/onekey/keymaps/i2c_scanner)

https://github.com/qmk/qmk_firmware/compare/master...JohSchneider:yamsek.qmk_firmware:yamsek_2022 might be a "source of insipration"? qmk talking to an mcp23017, running on rp2040 back then the rp2040 support in qmk was still WIP; but is AFAIK now part of it

I'm not a coder at all, the C code is kind of abracadabra for me. :-)

well then, take it as a challenge/opportunity to learn; the open-source is out there, just waiting to be read :-)

azhizhinov commented 1 month ago

Hello. Yes, pin 9 = 3.3V, pin 10 = GND. Could you, please, explain me pullup resistors. So, these are pullups, right? image So, here should be zeroes, right? image

azhizhinov commented 1 month ago

qmk_firmware/tree/master/keyboards/handwired/onekey/keymaps/i2c_scanner

I'm trying to use this firmware and don't understand, should I add #define I2C1_SCL_PIN GP13 and #define I2C1_SDA_PIN GP12? How this i2c_scanner will find an expander without this information?

JohSchneider commented 1 month ago

'up' is usually the supply voltage, and 'down' is Gnd btw - there are other good examples and 'reference' schematics https://learn.adafruit.com/adafruit-mcp23017-i2c-gpio-expander

So here should be zeroes, right?

depends... what have you set the port a and port b to put out? which port is supposed to drive the matrix high (either rows or columns... depends on your wiring), which ports are supposed to read/scan the matrix? (again: either rows or columns) those pull-downs you encircled are on port a (GPA0 etc)

How this i2c_scanner will find an expander without this information?

you have to configure the i2c to match your wiring; and since rp2040 can mux pins almost everywhere... :-)

azhizhinov commented 1 month ago

Hello. I've compiled onekey/i2c_scanner, flashed, but it always says "No I2C device found". I've checked wiring with multi-meter - GPIO12 (SDA) at MCU is connected to SDA (13) at MCP and GPIO13 (SCL) at MCU is connected to SCK (12) at MCP. Don't understand why the MCP can't be found.

azhizhinov commented 1 month ago

Finally. :-) image

azhizhinov commented 1 month ago

depends... what have you set the port a and port b to put out? which port is supposed to drive the matrix high (either rows or columns... depends on your wiring), which ports are supposed to read/scan the matrix? (again: either rows or columns) those pull-downs you encircled are on port a (GPA0 etc)

Your keyboard is ROW2COL, but in my case, it's COL2ROW, so GPBs are output and GPAs are input. If I correctly understand this picture. Your code is supposed to work with ROW2COL only?

JohSchneider commented 1 month ago

again the unpopular answer: "depends" ;-) depends on how you wire up your key-matrix, implement the matrix scanning, ..., ... the ioexpander itself doesn't care much about row2col or not; you just have to implement it in the matrix scanning code according to how you wire things up - follow the signal path through one switch+diode and keep the external pull-downs in mind