Open superami-code opened 3 years ago
The 10K pull ups might be a little high but you can try increasing this value and see if it improves. I'd probably at least double it. On develop branch you could just define it in your config.h.
Thank you for the quick response.
Increasing ERROR_DISCONNECT_COUNT to 20, seems to have helped , but not solved the issue. I suspect that its also my interconnect cable. I didn't pay enough attention when I made the purchase and its 1.2m (coiled). I've ordered a 0.3m cable which should arrive next week and hopefully also help with the I2C communications.
On the I2C I wanted to keep the build mirrored as much as possible so I used a 10k pull-up on each side, which I figured would make the resistance to VCC about 5k. What would be better values for these?
Ahh that's a pretty long cable, it may not even be a problem with the shorter one.
So the shorter error did reduce errors, but there are still issue with double key presses and RGB matrix synchronization. Is it possible to slow down the I²C or would a lower pull-up on each end be better? Is there a guide to how the pick the optimum pull-up?
I'd aim for something like a 2.2k resistance overall on both lines. A 4.7k on both sides (i.e. a parallel resistor network) should be fine.
Part of the problem I'd imagine is that I2C is non-responsive while sending out the RGB data to the SK6812's -- 38 LEDs per side would mean about 1.4ms of complete unresponsiveness from the slave due to the RGB requiring the disabling of interrupts.
You've also typo'd RGBLEG_SPLIT
-- should be RGBLED_SPLIT
.
Part of the problem I'd imagine is that I2C is non-responsive while sending out the RGB data to the SK6812's -- 38 LEDs per side would mean about 1.4ms of complete unresponsiveness from the slave due to the RGB requiring the disabling of interrupts.
Disabling the interrupts for the inter RGB time is painful. I will need to look into a better solution here. As the whole train of data needs to go out, I doubt it will be a trivial fix. Maybe I can split the RGB's onto multiple pins. Where is the code for the RGB's located? Specifically the code that would disable the RGB's
You've also typo'd
RGBLEG_SPLIT
-- should beRGBLED_SPLIT
.
Thanks for the tip, I'd already found that one.
You could just try compiling with RGBLIGHT_ENABLE = no
(maybe you would need to fix some custom code that calls RGB functions), and check whether that affects the communication errors. Alternatively, you could just set RGB to a static mode without any animations (and disable any code which uses RGB LEDs as indicators, if you have it).
Splitting RGB LEDs onto multiple pins is not supported (the problem is that on AVR the addresses of the corresponding port registers need to be compiled into the assembly code, therefore RGB_DI_PIN
must be a compile time constant).
However, disabling interrupts should not be a major problem for I2C — the slave controller should just use clock stretching to pause the transfer until the interrupt is serviced, and the timeout used by the master side seems to be 100 ms, so there should not be any communication errors caused just by this. But 1.4ms with interrupts disabled could still cause some timer ticks to be lost (this may cause some RGB sync issues, although there is the “sync timer” code which should fix them).
You could just try compiling with
RGBLIGHT_ENABLE = no
(maybe you would need to fix some custom code that calls RGB functions), and check whether that affects the communication errors. Alternatively, you could just set RGB to a static mode without any animations (and disable any code which uses RGB LEDs as indicators, if you have it).Splitting RGB LEDs onto multiple pins is not supported (the problem is that on AVR the addresses of the corresponding port registers need to be compiled into the assembly code, therefore
RGB_DI_PIN
must be a compile time constant).However, disabling interrupts should not be a major problem for I2C — the slave controller should just use clock stretching to pause the transfer until the interrupt is serviced, and the timeout used by the master side seems to be 100 ms, so there should not be any communication errors caused just by this. But 1.4ms with interrupts disabled could still cause some timer ticks to be lost (this may cause some RGB sync issues, although there is the “sync timer” code which should fix them).
Turning off the RGB animation with the RGB_TOG button seems to fix key stroke issues. I will look into other solutions deeper in the code when I have more time. It would be great to have both split and full RGB capabilities. Another oddity I noticed, was that when the halves were both connected via USB, Linux often had real lag between fast typing and the letters actually appearing in an editor or browser.
I couldn't figure out how to disable the I2C interrupt and tried switching to serial communications, but the issues are also present there. For now, I have no issues when using slow or static animations. This seems to confirm that the issue is not a hardware, but rather a software issue. I still need to figure out if the issue is with the time it takes to run the animation or the time it takes to transfer the animations between halves.
Describe the Bug
I have as split keyboard with I²C communications. Both halves work great when connected via USB directly. However, when one half is connected via interlink cable to the other, then that half produces double key presses, not always but frequently. It doesn't matter which half either. Like I said its double odd since they both work on their own just fine.
I've tried playing with the de-bouncing, but it doesn't seem to resolve things, and again they both work fine when connected directly via USB.
System Information
Keyboard:
Custom ErgoDactyl using AmoebaKing PCB (1 per key, an AmoebaRoyale variant)
Operating system:
AVR GCC version: 11.1.0
QMK Firmware version: 0.13.5
Rules.mk
Config.h