rgwan / librech551

Open-source CH55x flashing tool, SDK....
148 stars 36 forks source link

The chip id 0x00 is currently not support in this program #16

Open prosper00 opened 3 years ago

prosper00 commented 3 years ago

Linux (Ubuntu 20.10):

$ wchisptool 
Error while bulking in: LIBUSB_ERROR_OVERFLOW
Libre CH551 Flasher 2018
The chip id 0x00 is currently not support in this program

I did get a few compiler warnings when building:

$ make
cc -O2 main.c -o wchisptool `pkg-config --cflags --libs libusb-1.0`
main.c: In function ‘main’:
main.c:230:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
  230 |  libusb_set_debug(NULL, 3);
      |  ^~~~~~~~~~~~~~~~
In file included from main.c:25:
/usr/include/libusb-1.0/libusb.h:1325:18: note: declared here
 1325 | void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
      |                  ^~~~~~~~~~~~~~~~
main.c:327:3: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  327 |   fread(file_buffer, 1, file_length, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:588:3: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  588 |   fread(file_buffer, 1, file_length, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prosper00 commented 3 years ago

edit: the vnproch55 programmer used in ch55xduino works fine:

/home/bdroy/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2020.12.01/linux/vnproch55x /tmp/arduino_build_302531/CMSIS_DAP.ino.hex 
------------------------------------------------------------------
CH55x Programmer by VNPro
------------------------------------------------------------------
Load file as hex
   Loaded 9670 bytes between: 0000 to 25F3
DeviceVersion of CH55x: 2.40 
MCU ID: 52 11
Found Device CH552
Bootloader: 2.4.0
ID: 92 11 8A 5C
XOR Mask: 89 89 89 89 89 89 89 DB 
Write 9716 bytes from bin file.
.................................................
Write complete!!!
Verify chip
.................................................
Verify complete!!!
------------------------------------------------------------------

so does ch55xtool:

$ ./ch552tool.sh 
Found CH552.
BTVER: V2.40.
prosper00 commented 3 years ago

So, I guess this is because new (since about a year ago) chips ship with bootloader version 2.40, which librech551 doesn't support.

For the benefit of anyone else stumbling onto this repo with this problem, the following flashers DO work with more recent chips:

VNPro (patched for more CH55x chips) (https://github.com/LoveMHz/vnproch55x) This is what's used in ch55xduino

ch55x-isptool (https://github.com/ElectronicCats/ch55x-isptool)

chflasher (https://github.com/atc1441/chflasher)