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

hardware support #3

Open
johndoe71rus opened this issue Oct 14, 2017 · 30 comments
Open

hardware support #3

johndoe71rus opened this issue Oct 14, 2017 · 30 comments

Comments

@johndoe71rus
Copy link

does ponyprog support ch341A or PL2303 cheap chips?
thanks

@lancos
Copy link
Owner

lancos commented Oct 15, 2017

No. May be in the future when we'll add support for USB adapters.

@johndoe71rus
Copy link
Author

for ch341 i use https://github.com/setarcos/ch341prog
maybe you can use it too

@eduard-x
Copy link
Collaborator

eduard-x commented Oct 18, 2017

I think, in case of USB to serial adapters (like PL2303) under Linux it's easy to add into the list, but i don't know, is it equally simple under Windows?
On Linux is the adapter to find under /dev/ttyUSBx

@johndoe71rus
Copy link
Author

johndoe71rus commented Oct 18, 2017

ch341 has serial and parallel port interface.
they both(PL2303 and ch341) can be represented under /dev/ttyUSBx

https://www.onetransistor.eu/2017/08/ch341a-mini-programmer-schematic.html

@eduard-x
Copy link
Collaborator

Yes, but all old hardware solutions are very simple, without interface to microcontroller. I think, it's better to implement it with libusb. I have bought this programmer on aliexpress, and can begin with tests 3-4 weeks later, after delivery. :)
Thanks for ch341prog source code link!

@eduard-x
Copy link
Collaborator

eduard-x commented Oct 19, 2017

Yes, but all old hardware solutions are very simple, without interface to microcontroller. I think, it's better to implement it with libusb. I have bought this programmer on aliexpress, and can begin with tests 3-4 weeks later, after delivery. :)
Thanks for ch341prog source code link!

p.s. sorry because of close/open of ticket, was mistake of button description

@eduard-x eduard-x reopened this Oct 19, 2017
@lancos
Copy link
Owner

lancos commented Oct 19, 2017

Thank you for the links. CH341 (like other chips, for example FTDI) support SPI and I2CBus.
The problem is that ponyprog implements the SPI and I2CBus via bit-banging and add the USB
adapters need a restructure that was planned several weeks ago, but I need to find the time to do it. Now that ponyprog was ported to QT it is the first item in the TODO list.

@eduard-x
Copy link
Collaborator

Hi!
I have now the CH341, can begin with implementation on Linux.
Best regards,
Eduard

@johndoe71rus
Copy link
Author

@eduard-x
How is the work going?

@eduard-x
Copy link
Collaborator

Hello johndoe71rus,
i was busy with porting of Qucs to Qt5 and now for 1-2 month i'm writing my project for mk1 cnc.
Possible, in may-june i'll try to integrate the CH341 interface.

@JucaTec
Copy link

JucaTec commented Sep 9, 2018

Hi. Any news about USB? Thank you.

@eduard-x
Copy link
Collaborator

Hi!
in next 2-3 weeks i'll try to compile it and to test the flashing. Sorry for delaying.

@eduard-x
Copy link
Collaborator

eduard-x commented Feb 7, 2019

Hello! From this weekend i will continue to work on this usb extension. Was very busy last months at work.

@eduard-x
Copy link
Collaborator

Hi!
At this time was extended the connection selecting popup for ch341a connection types: i2c, spi and uart.
In PonyProg is enabled autodetection of USB devices: 1a86:5512 and 1a86:5523
I'm trying to connect to ch341a class. Possible, i'll test it on this weekend or next week. All sources are in this branch: wip/eduard/libusb-patches

@eduard-x
Copy link
Collaborator

eduard-x commented Mar 25, 2019

Hi!
I need your help in debugging. At this moment i have implemented in "libusb-patches" branch the functions for bit-banging. All HW connections are like here: i2c rs232 but without z-diodes and instead RS232 connectors i use this board ch341 board at hackaday in UART mode
Description for connectors from my file in branch:

/**
 * ch341a modem connections:
 *
 * rs232 -> ch341  description
 *     1 -> 18     data carrier detect
 *     2 -> 6      Rx
 *     3 -> 5      Tx
 *     4 -> 20     Data Terminal Ready
 *     5              Ground
 *     6 -> 16     Data Set Ready
 *     7 -> 21     Request To Send
 *     8 -> 15     Clear To Send
 *     9 -> 17     Ring Indicator
 **/

And i'm getting from PonyProg followed debugging list (project compiled with enabled debug option):

ch341::Open( 6790 21795 ) 
ch341::Configure()
Open device [1a86:5523].
Claim interface 0
Device reported its revision [4.03]
SIProgInterface::OpenUSB() =  0  OUT
e2App::OpenBus() ** OpenUSB =  0
e2App::OpenBus() ** SetPower
e2App::OpenBus() ** Reset
I2CBus::Reset() - IN
I2CBus::SetDelay() =  5
I2CBus::Read( 0 ,  0x7fffffffc127 ,  0 ) - IN
I2CBus::StartRead( 0 ,  0x7fffffffc127 ,  0 ) - IN
I2CBus::StartRead() =  1 , err_no =  0  - OUT
I2CBus::Read() =  1 , err_no =  0  - OUT
I2CBus::Reset() - OUT
e2AppWinInfo::Read() ** OpenBus =  0
E24xx::Probe( 1 ) - IN
I2CBus::Read( 160 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 160 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 162 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 162 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 164 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 164 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 166 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 166 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 168 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 168 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 170 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 170 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 172 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 172 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
I2CBus::Read( 174 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::StartRead( 174 ,  0x7fffffffc18b ,  1 ) - IN
I2CBus::Read() =  0 , err_no =  -13  - OUT
E24xx::Probe() =  0  - OUT
e2App::CloseBus() iniBus= 0x7fffffffd758
I2CBus::Close() busI= 0x7fffffffd398
SIProgInterface::Close() IN *** Inst= true
SerialInterface::CloseSerial()
SIProgInterface::Close() OUT
e2AppWinInfo::Read() =  0  - OUT
CmdWindow->Read -- Error

I'm trying to find the find the bug(s), but possible with more eyes we can find this faster :)
Do not forget under Linux to install the file uart/rules.d/99-ponyprog.rules under /etc/udev/rules.d/ and restart udev for user access to HW

@eduard-x
Copy link
Collaborator

eduard-x commented Apr 4, 2019

Yes! I can read my 24c16 about the USB in UART mode! :)
For connection set in Interface PopUp window "Invert D-In", "Invert D-Out", "Invert SCKL" to checked.
The settings for Baudrate are now without any effect, this is not implemented.
The UART mode is direct communication without buffering. For this solution we don't need the original CH341 driver. Of cause, it is possible to extend later with I2C and SPI interfaces.
On weekend i will clean the source code in libusb-patches branch.
I'm planning to extend this interface with CP2102, PL2303 devices, the common things to implement in abstract class, but after testing in high speed of ch341.

@eduard-x
Copy link
Collaborator

eduard-x commented Apr 8, 2019

Now i'm busy with additional Interfaces for ch341a: i2c, spi.

@JucaTec
Copy link

JucaTec commented Apr 9, 2019

Thanks for the work. Are you going to make software for Windows?

@eduard-x
Copy link
Collaborator

eduard-x commented Apr 9, 2019

Yes, after testing of USB integrated driver, libusb is an multiplatform library. But i don't know, what is with exec rights, i think, the program under Win must be start with admin rights. Under Linux is it easier to allow this with udev rules file for users.

@johndoe71rus
Copy link
Author

Try to build (lubuntu 18.04)
https://paste.ubuntu.com/p/KWVTnpzhZN/
i install libftdi-dev and libftdi1-dev

@lancos
Copy link
Owner

lancos commented Jun 24, 2019

You need to install libftdipp1-dev on 18.04

@johndoe71rus
Copy link
Author

i use ch341prog with ch341A only one time to read/write 25q64xxxxx
this pcb https://images.ua.prom.st/879432686_w640_h640_usb-programmator-ch341a.jpg with 8 pin clip.
Now, can i use branch "libusb-patches" try read/write 25q64xxxxx with ponyprog or not?

@engmarcos26 engmarcos26 mentioned this issue Jan 7, 2020
@engmarcos26
Copy link

WHAT IS HW? COMPLET TEXT, PLIS!

@johndoe71rus
Copy link
Author

I found a device with a weird usb serial bridge. defined as ID 1a86:7522 QinHeng Electronics. Google finds device ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter. I found the manufacturer page http://www.wch-ic.com/products/CH340.html similar to ch340k, 10 pin. For download, they suggest the file CH341SER_LINUX.ZIP but I can not build it because of an error. You can also find the file CH341PAR_LINUX.ZIP

@christian-0s
Copy link

I found a device with a weird usb serial bridge. defined as ID 1a86:7522 QinHeng Electronics. Google finds device ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter. I found the manufacturer page http://www.wch-ic.com/products/CH340.html similar to ch340k, 10 pin. For download, they suggest the file CH341SER_LINUX.ZIP but I can not build it because of an error. You can also find the file CH341PAR_LINUX.ZIP

You do not need another driver, just manually load module ch341 and then enter:
sudo sh -c "echo 1a86 7522 > /sys/bus/usb-serial/drivers/ch341-uart/new_id"

@johndoe71rus
Copy link
Author

do you think so?
Linux driver CH341 don't know about ID 7522
https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c#L78

@christian-0s
Copy link

christian-0s commented Jun 30, 2020

That's why you have to write it to new_id.
Tested on a LilyGO board based on ESP8266, which has a CH340K
EDIT: this one http://www.lilygo.cn/claprod_view.aspx?TypeId=21&Id=1235&FId=t28:21:28

@johndoe71rus
Copy link
Author

johndoe71rus commented Jun 30, 2020

yep. Exactly this LILYGO board.

It work. Thanks!

@GuilhermeMoreno
Copy link

@eduard-x Any news on the support of USB adapters for programming EEPROMs? Did you managed to get it working with CP2102?

@mrv96
Copy link

mrv96 commented Nov 7, 2022

I'm intrested too about CH341 support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants