Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpio-ch341.c: write_outputs, use new command #20

Closed
wants to merge 3 commits into from

Conversation

mr-nice
Copy link
Contributor

@mr-nice mr-nice commented Oct 19, 2023

Change write_outputs to use the 0xA1 pin IO interface from https://github.com/rogerjames99/spi-ch341-usb/blob/master/spi-ch341-usb.c

Keep the current interface of the old command and don't use new pins.

Reverse engineered from @Icenowy and @geeksville

Also used at the manufacturers driver code example https://github.com/zoobab/ch341-parport/blob/master/CH341PAR_LINUX/demo/ch34x_lib.c

Change write_outputs to use the 0xA1 pin IO interface
from https://github.com/rogerjames99/spi-ch341-usb/blob/master/spi-ch341-usb.c

Keep the current interface of the old command and don't use new pins.

Reverse engineered from @Icenowy and @geeksville

Also used at the manufacturers driver code example
https://github.com/zoobab/ch341-parport/blob/master/CH341PAR_LINUX/demo/ch34x_lib.c

Signed-off-by: Bernhard Guillon <Bernhard.Guillon@begu.org>
@mr-nice
Copy link
Contributor Author

mr-nice commented Oct 19, 2023

Hi,
I did the first step and changed the I/O command to the new interface without changing anything on the other interfaces. I tested the result with gpioget with pins driven to low (connect gnd to the pin). And tested the outputs D0-D5 with gpioset and a logic analyzer.
I was unable to test the SPI interface because this would need the INI# pin. I was also unable to test I2C because there is no driver for my I2C device. I have an I2C device and I can connect it but I missed some parts to get i2cdetect to work with both write_output implementations. I need to further investigate that, because I never used that on a non embedded machine. I can test the things you want me to test, if you provide information on how to test them.

I left out all the enhancements which this interface gives us to another PR to solve #5

The library code mentioned that it might be possible to use more pins as outputs but I leave that out for later.

Greets,
mr-nice

gpio-ch341.c Outdated Show resolved Hide resolved
@mr-nice mr-nice force-pushed the change-io-interface branch 2 times, most recently from 229661e to 93e9dbb Compare October 23, 2023 16:18
Signed-off-by: Bernhard Guillon <Bernhard.Guillon@begu.org>
gpio-ch341.c Outdated Show resolved Hide resolved
@frank-zago
Copy link
Owner

frank-zago commented Oct 28, 2023

Thanks. That looks good. I've tested it as well. Fix the typo and I'll merge.

Signed-off-by: Bernhard Guillon <Bernhard.Guillon@begu.org>
@frank-zago
Copy link
Owner

rebased and merged.

@frank-zago frank-zago closed this Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants