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

.exe version finds device, but not .py version #4

Open
maxgerhardt opened this issue Apr 2, 2021 · 0 comments
Open

.exe version finds device, but not .py version #4

maxgerhardt opened this issue Apr 2, 2021 · 0 comments

Comments

@maxgerhardt
Copy link

maxgerhardt commented Apr 2, 2021

I have a weird situation where when I use the Python version of the tool I get

>python C:\Users\Max\chflasher\chflasher.py .pio\build\ch559\firmware.bin
Could not access USB Device
Traceback (most recent call last):
  File "C:\Users\Max\chflasher\chflasher.py", line 36, in <module>
    dev.set_configuration()
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 905, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 159, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\backend\libusb1.py", line 812, in set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\backend\libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

But when I use the .exe version

>C:\Users\Max\chflasher\chflasher.exe .pio\build\ch559\firmware.bin
Found CH559
Bootloader version: 2.31
Flash Erased
Filesize: 194 bytes
Error: Something wrong with the bin file

Also the firmware doesn't seem to be uploaded correctly because even after a reset the blinky firmware is not executing. If I use https://github.com/LoveMHz/vnproch55x it works in regards to flashing and execution.

>C:\Users\Max\Desktop\tools\win\vnproch55x.exe .pio\build\ch559\firmware.bin
------------------------------------------------------------------
CH55x Programmer by VNPro
------------------------------------------------------------------
Found Device CH559
Bootloader: 2.3.1
ID: 1B AC 4B 41
XOR Mask: 53 53 53 53 53 53 53 AC
Write 194 bytes from bin file.
..................................................
Write complete!!!
Verify chip
..................................................
Verify complete!!!
------------------------------------------------------------------

My Python version is 3.8.6, the installed pyusb version is the latest 1.1.1

t>pip install --upgrade pyusb
Requirement already satisfied: pyusb in c:\users\max\appdata\local\programs\python\python38\lib\site-packages (1.1.1)

Also Zadig was previously used to install libusb drivers. (and the other upload tool thus sees it too)

Any ideas why the py version won't even find the device but the .exe version does?

I assume the failure to write the firmware file in the .exe case is due to the hard exit condition bug for <256 Byte firmwares as mentioned per #3.

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

No branches or pull requests

1 participant