ponyprog icon indicating copy to clipboard operation
ponyprog copied to clipboard

hardware support

Open johndoe71rus opened this issue 7 years ago • 30 comments

does ponyprog support ch341A or PL2303 cheap chips? thanks

johndoe71rus avatar Oct 14 '17 07:10 johndoe71rus

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

lancos avatar Oct 15 '17 00:10 lancos

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

johndoe71rus avatar Oct 15 '17 04:10 johndoe71rus

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

eduard-x avatar Oct 18 '17 10:10 eduard-x

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

johndoe71rus avatar Oct 18 '17 15:10 johndoe71rus

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 avatar Oct 19 '17 05:10 eduard-x

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 avatar Oct 19 '17 05:10 eduard-x

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.

lancos avatar Oct 19 '17 09:10 lancos

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

eduard-x avatar Nov 29 '17 20:11 eduard-x

@eduard-x How is the work going?

johndoe71rus avatar Feb 11 '18 11:02 johndoe71rus

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.

eduard-x avatar Feb 28 '18 20:02 eduard-x

Hi. Any news about USB? Thank you.

JucaTec avatar Sep 09 '18 00:09 JucaTec

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

eduard-x avatar Oct 14 '18 16:10 eduard-x

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

eduard-x avatar Feb 07 '19 06:02 eduard-x

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 avatar Feb 21 '19 20:02 eduard-x

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 avatar Mar 25 '19 22:03 eduard-x

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 avatar Apr 04 '19 21:04 eduard-x

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

eduard-x avatar Apr 08 '19 17:04 eduard-x

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

JucaTec avatar Apr 09 '19 00:04 JucaTec

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.

eduard-x avatar Apr 09 '19 06:04 eduard-x

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

johndoe71rus avatar Jun 21 '19 05:06 johndoe71rus

You need to install libftdipp1-dev on 18.04

lancos avatar Jun 24 '19 09:06 lancos

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?

johndoe71rus avatar Aug 09 '19 05:08 johndoe71rus

WHAT IS HW? COMPLET TEXT, PLIS!

engmarcos26 avatar Jan 07 '20 18:01 engmarcos26

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

johndoe71rus avatar Jun 09 '20 03:06 johndoe71rus

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"

christian-0s avatar Jun 28 '20 16:06 christian-0s

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

johndoe71rus avatar Jun 30 '20 18:06 johndoe71rus

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

christian-0s avatar Jun 30 '20 18:06 christian-0s

yep. Exactly this LILYGO board.

It work. Thanks!

johndoe71rus avatar Jun 30 '20 19:06 johndoe71rus

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

GuilhermeMoreno avatar Feb 28 '21 20:02 GuilhermeMoreno

I'm intrested too about CH341 support

mrv96 avatar Nov 07 '22 08:11 mrv96