setarcos / ch341prog Goto Github PK
View Code? Open in Web Editor NEWA simple SPI/IIC programer based on ch341a.
License: GNU General Public License v3.0
A simple SPI/IIC programer based on ch341a.
License: GNU General Public License v3.0
As mentioned in the libusb docs, libusb_open_device_with_vid_pid
is nice for simple tests but too limited for serious use. Is any somewhat experienced C programmer reading who could upgrade our detection so I can select a specific CH341A via bus number and device number?
I might try and implement it myself but it's a long time since I've last dealt with C, so not sure if my attempt will be as helpful as I'd hope. (Usually I use python for USB stuff.)
The code added with this commit doesn't find any error even if the firmware has been corrupted during the write process.
The issue is here:
int ch1, ch2;
ch1 = getc(fp);
ch2 = getc(test_file);
while ((ch1 != EOF) && (ch2 != EOF) && (ch1 == ch2)) {
ch1 = getc(fp);
ch2 = getc(test_file);
}
The "start of file" pointers of FILE *
variables are not reset before start the test. ch1
and ch2
are always equal to EOF
so the test exit always without find any errors.
To solve the BUG you have to modify the code in this way:
fseek(fp, 0, SEEK_SET);
fseek(test_file, 0, SEEK_SET);
int ch1, ch2;
ch1 = getc(fp);
ch2 = getc(test_file);
while ((ch1 != EOF) && (ch2 != EOF) && (ch1 == ch2)) {
ch1 = getc(fp);
ch2 = getc(test_file);
}
You have also to modify the mode used to open the test_filename
file from:
test_file = fopen(test_filename, "wb");
to:
test_file = fopen(test_filename, "w+b");
In this way the verification of a written firmware works fine! ;-)
Could you add this patch to your code?
Thanks...
Gianluca
Please see my GUI interface for this program: CH341a_spi_programmer
I guess your Project supports the flashing of i2c eeproms.
But for me, only SPI ones got detected. Is there anything i have to set to use i2c?
When writing large flash chips, the ETA displayed in verbose mode goes negative.
The problem is integer overflow when calculating the ETA time:
(int) ( (dur*size*1.0)/done-dur))
When dur*size > 2^31 (such as size = 8MB and dur > 256s), this overflows signed integers before being cast to double, so the ETAs for the second half of the write are negative nonsense.
(i get bored waiting on the flash to write)
Awesome job also it works on MacOS.
Thanks a lot.
Hi
I'm working with MX25L25735FMI FLASH chip, trying to read it's content over SPI. And I noticed that offset command works in some weird way way:
--offset 1
will give offset of 0h100 bytes instead of 1 byte
--offset 2
will give offset of 0h200 bytes instead of 2 bytes
and so on.
Is there any way to set offset for reading in bytes instead of hex hundreds of bytes?
Thanks.
Hello,
I had a query that are there some specific eeprom chips that are detected. I tried with SPI EEPROM 25LC256 , checked connection properly but device was not detected.
Thanks & Regards
Asmita
Hello. I have CH341 programmer from ebay, but it not work with this software.
$ lsusb
Bus 001 Device 005: ID 1a86:5523 QinHeng Electronics CH341 in serial mode, usb to serial port converter
This software work only with 1a86:5512. It can be modified to work with 1a86:5523?
My programmer is bought http://www.ebay.com/itm/201364328713
Many thanks!
when i try to erase some 25q128, sometimes an error appears after a some minuts:
chip erase timeout.
Hello,
I have a ch341 usb adapter (1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter).
When I run your program all the information are wrong (ff).
The program gave me the error "No CFI structure found, trying to get capacity from device ID. Set manually if detection fails."
If I set manually the length in bytes (2048) the result don't change.
What I have to make to solve?
The eeprom is a pc2400 (24c02),
Thank you and compliments for your program,
cheers,
Paolo
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.