command-tab / ch341eeprom

A libusb based programming tool for 24Cxx serial EEPROMs using the WinChipHead CH341A IC
GNU General Public License v3.0
149 stars 58 forks source link

Read protocol cleanup and other minor cleanups #14

Closed frank-zago closed 3 years ago

frank-zago commented 3 years ago

Tested with an 24c256 eeprom.

make test256

clang -Wall -O2 -o ch341eeprom ch341eeprom.c ch341funcs.c -lusb-1.0 clang -Wall -O2 -o mktestimg mktestimg.c dd if=/dev/urandom of=tmp_random.bin bs=128 count=256 256+0 records in 256+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.00188764 s, 17.4 MB/s ./ch341eeprom -v -s 24c256 -w tmp_random.bin Searching USB buses for WCH CH341a i2c EEPROM programmer [1a86:5512] Found [1a86:5512] as device [5] on USB bus [1] Opened device [1a86:5512] Claimed device interface [0] Device reported its revision [4.03] Configured USB device with vendor ID: 1a86 product ID: 5512 Set i2c bus speed to [100kHz] Read [32768] bytes from file [tmp_random.bin] Wrote [32768] bytes to [24c256] EEPROM
Closed USB device ./ch341eeprom -v -s 24c256 -r tmp_random_readed.bin Searching USB buses for WCH CH341a i2c EEPROM programmer [1a86:5512] Found [1a86:5512] as device [5] on USB bus [1] Opened device [1a86:5512] Claimed device interface [0] Device reported its revision [4.03] Configured USB device with vendor ID: 1a86 product ID: 5512 Set i2c bus speed to [100kHz] Read [32768] bytes from [24c256] EEPROM Wrote [32768] bytes to file [tmp_random_readed.bin] Closed USB device cmp tmp_random.bin tmp_random_readed.bin rm -f tmp_random.bin tmp_random_readed.bin Test 256Kbit/32Kbyte EEPROM done

command-tab commented 3 years ago

Thanks! This also addresses #16