Ho-Ro / Hantek6022API

Hantek 6022BE Python API for Windows and Linux.
https://ho-ro.github.io/Hantek6022API/
Other
97 stars 15 forks source link

Support for USBee-DX clone #6

Closed Deusex25 closed 3 years ago

Deusex25 commented 4 years ago

Hi guys. Recently I got my hands on a clone of USBee-DX device. This is combined logic analyzer and oscilloscope. I was hoping to make it working under Linux with Sigrok PulseView software, but unfortunately it supports only analyzer. Googling this issue brought me to few articles, with information, that this devices are hardware compatible to Saleae logic analysers and stating that Handek 6022 is basically improved clone of the same USBee-DX... Indeed, checking the drawings I've found, led me to conclusion that at least general configuration is very similar: both devices are using Cypress FX2 chip (100-pin CY7C68013A-100 in case of Hantek and 56-pin Cypress CY7C68013A-56 in case of USBee-DX clone), which is getting information from ADCs (one dual ADC AD9288 and two single TLC5510 respectively) over B and D ports, and both devices are getting the firmware from PC software.

Winged by this information I started experimenting with different VID/PID values, trying to get USBee-DX clone represent itself as 6022, and even got it detected as Hantek and driver loaded. Unfortunately OpenHantek software shows an error, stating that it cannot load the firmware.

My question is: will it be possible to get a support for USBee-DX compatible oscilloscopes? What can I do from my side? I'm programming a bit (C & C++), but I'm not professional. I do not know, from which side to approach to this issue.

Ho-Ro commented 4 years ago

If your device uses one FX2 chip it should at least load the firmware and work - maybe with bogus values - but if it uses two FX2 chips (one for LA, the other for scope), you must be sure to address the right chip. As a starting point you could use my test setup that works with a cheap saleae clone, that is more or less a FX2 devel board. Uncomment this line: // #define LCSOFT_TEST_BOARD and plug in... It is detected and works without any HW change, only the returned values are senseless. https://github.com/OpenHantek/OpenHantek6022/blob/2ae596f8771e788f401f01eb06026ce6ad682180/openhantek/src/hantekdso/models/modelDSO6022.h#L33

// two test cases with simple EZUSB board (LCsoft) without EEPROM or with Saleae VID/PID in EEPROM
// after loading the FW they look like a 6022BE (without useful sample values as Port B and D are left open)
// LCSOFT_TEST_BOARD is also used in modelDSO6022.cpp

// #define LCSOFT_TEST_BOARD

#ifdef LCSOFT_TEST_BOARD

struct ModelEzUSB : public DSOModel {
    static const int ID = 0x6022;
    ModelEzUSB();
    void applyRequirements(HantekDsoControl* dsoControl) const override;
};

struct ModelSaleae : public DSOModel {
    static const int ID = 0x6022;
    ModelSaleae();
    void applyRequirements(HantekDsoControl* dsoControl) const override;
};

#endif
Ho-Ro commented 4 years ago

A short search confirmed my assumption regarding the two FX2, see this polish forum, the PCB and the schematics.

Deusex25 commented 4 years ago

Hi Martin. The photo on this forum shows the board without modification. I have removed R12 and R13, and soldered 24LC01B and three pull-up resistors. Therefore each FX2 chip now has it's own EEPROM! The original 24LC02B now is dedicated for logic analyser and the new one is for oscilloscope part. I have extracted the data from 6022 chip and loaded it to USBee-DX clone (reduced original size to 128 bytes to fit in 24LC01B, since only 40 first bytes are in use). Lsusb shows this for both 6022 and USBee-DX just after connection to PC: 04b4:6022 Cypress Semiconductor Corp. When I run the software, USBee-DX just disappears (probably after firmware is loaded), while in case of Hantek 6022 lsusb shows: 04b5:6022 ROHM LSI Systems USA, LLC

Have tried it with PulseView - same story. As soon as I try to connect to USBee-DX, it disappears.

Ho-Ro commented 4 years ago

What does dmesg say when it disappears? To understand your setup - you added U4 and R14, R20 and R23, now your modified HW looks similar to this schematic - when freshly plugged in it announces the LA FX2 as 08a9:0015 according to the sigrok doc and the (modified) scope FX2 as 04b4:6022 (Hantek w/o FW). Regarding the EEPROM content: you need only the 1st 8 bytes that define the load format (0xC0 in our case), VID, PID and DID (device id) and a config byte -> 000000: c0 b4 04 22 60 00 00 00 (see TRM, section 3.4). Another test would be to disable the EEPROM of the scope section (it enumerates as bare FX2 04B4:8613) and use my hack from above. But what I've seen from the schematics is the strange interaction between the two FX2, the LA delivers the ADC clock (probably via GPIF as FIFO master) and this signal is also used as the clock input to the scope FX2 (slave FIFO mode). This is described in depth in the Cypress TRM, section 9 and section 10. But this shouldn't create trouble because the Hantek FW doesn't need any external signals.The Hantek works in FIFO master mode and provides the ADC clock - from IFCLK for the high speed sampling (48 MS/s & 30 MS/s) and from CTL2 for the lower speeds -> see last page of the user manual.

Deusex25 commented 4 years ago

Hi Martin.

I have compiled software with modifications, and disconnected SDA jumper (so FX2 will work without EEPROM) before plugging USBee-DX into PC. The result is pretty much the same as when EEPROM was connected: for a second I can see that software has detected LCsoft-EzUSB device and below it "Upload in progress...". Next moment device disappears from device list and lsusb shows absence of 6022 device in system. Dmesg shows this (USB related part): [ 2866.902620] usb 1-1: new high-speed USB device number 5 using xhci_hcd [ 2867.050927] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 2867.050932] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2867.052332] hub 1-1:1.0: USB hub found [ 2867.052386] hub 1-1:1.0: 2 ports detected [ 2867.338658] usb 1-1.1: new high-speed USB device number 6 using xhci_hcd [ 2867.439204] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 2867.439209] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2867.518493] usb 1-1.2: new high-speed USB device number 7 using xhci_hcd [ 2867.622798] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 [ 2867.622806] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2867.663637] usbtest 1-1.2:1.0: FX2 device [ 2867.663640] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 2867.663731] usbcore: registered new interface driver usbtest [ 3011.437532] usbtest 1-1.2:1.0: FX2 device [ 3011.437534] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3011.592832] usb 1-1.2: USB disconnect, device number 7 [ 3013.096475] usb 1-1.2: new high-speed USB device number 8 using xhci_hcd [ 3018.397013] usb 1-1.2: device descriptor read/64, error -110 [ 3034.015326] usb 1-1.2: device descriptor read/64, error -110 [ 3034.203070] usb 1-1.2: new high-speed USB device number 9 using xhci_hcd [ 3039.391756] usb 1-1.2: device descriptor read/64, error -110 [ 3046.224733] usb 1-1: USB disconnect, device number 5 [ 3046.224754] usb 1-1-port2: cannot reset (err = -71) [ 3046.224825] usb 1-1-port2: attempt power cycle [ 3046.541272] usb 1-1.1: USB disconnect, device number 6 [ 3052.705630] usb 1-1: new high-speed USB device number 12 using xhci_hcd [ 3052.853845] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3052.853851] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3052.855228] hub 1-1:1.0: USB hub found [ 3052.855278] hub 1-1:1.0: 2 ports detected [ 3053.145689] usb 1-1.1: new high-speed USB device number 13 using xhci_hcd [ 3053.246207] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3053.246213] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3053.329401] usb 1-1.2: new high-speed USB device number 14 using xhci_hcd [ 3053.433810] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=6022, bcdDevice= 0.00 [ 3053.433815] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3054.345262] usb 1-1.2: USB disconnect, device number 14 [ 3055.845787] usb 1-1.2: new high-speed USB device number 15 using xhci_hcd [ 3061.154611] usb 1-1.2: device descriptor read/64, error -110 [ 3076.772223] usb 1-1.2: device descriptor read/64, error -110 [ 3076.960277] usb 1-1.2: new high-speed USB device number 16 using xhci_hcd [ 3080.494410] usb 1-1: USB disconnect, device number 12 [ 3080.494538] usb 1-1-port2: attempt power cycle [ 3080.809314] usb 1-1.1: USB disconnect, device number 13 [ 3084.521344] usb 1-1: new high-speed USB device number 19 using xhci_hcd [ 3084.669626] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3084.669632] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3084.671192] hub 1-1:1.0: USB hub found [ 3084.671244] hub 1-1:1.0: 2 ports detected [ 3084.957399] usb 1-1.1: new high-speed USB device number 20 using xhci_hcd [ 3085.057692] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3085.057698] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3085.141108] usb 1-1.2: new high-speed USB device number 21 using xhci_hcd [ 3085.241596] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=6022, bcdDevice= 0.00 [ 3085.241602] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3086.345709] usb 1-1.2: USB disconnect, device number 21 [ 3087.849709] usb 1-1.2: new high-speed USB device number 22 using xhci_hcd [ 3093.158343] usb 1-1.2: device descriptor read/64, error -110 [ 3093.439518] usb 1-1: USB disconnect, device number 19 [ 3093.439754] usb 1-1-port2: attempt power cycle [ 3093.754526] usb 1-1.1: USB disconnect, device number 20 [ 3103.307379] usb 1-1: new high-speed USB device number 26 using xhci_hcd [ 3103.455435] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3103.455441] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3103.456796] hub 1-1:1.0: USB hub found [ 3103.456855] hub 1-1:1.0: 2 ports detected [ 3103.743379] usb 1-1.1: new high-speed USB device number 27 using xhci_hcd [ 3103.843946] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3103.843951] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3103.927238] usb 1-1.2: new high-speed USB device number 28 using xhci_hcd [ 3104.027528] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 [ 3104.027533] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3104.028016] usbtest 1-1.2:1.0: FX2 device [ 3104.028023] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3115.094075] usbtest 1-1.2:1.0: FX2 device [ 3115.094077] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3115.273882] usb 1-1.2: USB disconnect, device number 28 [ 3116.776771] usb 1-1.2: new high-speed USB device number 29 using xhci_hcd [ 3122.089318] usb 1-1.2: device descriptor read/64, error -110 [ 3130.008244] usb 1-1: USB disconnect, device number 26 [ 3130.008252] usb 1-1-port2: cannot reset (err = -71) [ 3130.008500] usb 1-1-port2: attempt power cycle [ 3130.322502] usb 1-1.1: USB disconnect, device number 27 [ 3132.206191] usb 1-1: new high-speed USB device number 33 using xhci_hcd [ 3132.354571] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3132.354576] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3132.356079] hub 1-1:1.0: USB hub found [ 3132.356156] hub 1-1:1.0: 2 ports detected [ 3132.646096] usb 1-1.1: new high-speed USB device number 34 using xhci_hcd [ 3132.746507] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3132.746512] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3132.826091] usb 1-1.2: new high-speed USB device number 35 using xhci_hcd [ 3132.930597] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 [ 3132.930599] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3132.930899] usbtest 1-1.2:1.0: FX2 device [ 3132.930900] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3528.103188] usbtest 1-1.2:1.0: FX2 device [ 3528.103191] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3528.206324] usb 1-1.2: USB disconnect, device number 35 [ 3529.707137] usb 1-1.2: new high-speed USB device number 36 using xhci_hcd [ 3535.043569] usb 1-1.2: device descriptor read/64, error -110 [ 3550.660157] usb 1-1.2: device descriptor read/64, error -110 [ 3550.848148] usb 1-1.2: new high-speed USB device number 37 using xhci_hcd [ 3556.036108] usb 1-1.2: device descriptor read/64, error -110 [ 3571.652741] usb 1-1.2: device descriptor read/64, error -110 [ 3571.761061] usb 1-1-port2: attempt power cycle [ 3572.365018] usb 1-1.2: new high-speed USB device number 38 using xhci_hcd [ 3577.544968] usb 1-1.2: device descriptor read/64, error -110 [ 3593.157763] usb 1-1.2: device descriptor read/64, error -110 [ 3593.345852] usb 1-1.2: new high-speed USB device number 39 using xhci_hcd [ 3598.538088] usb 1-1.2: device descriptor read/64, error -110 [ 3614.150678] usb 1-1.2: device descriptor read/64, error -110 [ 3614.258774] usb 1-1-port2: unable to enumerate USB device [ 3812.174199] usb 1-1: USB disconnect, device number 33 [ 3812.174205] usb 1-1.1: USB disconnect, device number 34 [ 3814.381505] usb 1-1: new high-speed USB device number 40 using xhci_hcd [ 3814.529801] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3814.529807] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3814.531255] hub 1-1:1.0: USB hub found [ 3814.531323] hub 1-1:1.0: 2 ports detected [ 3814.817652] usb 1-1.1: new high-speed USB device number 41 using xhci_hcd [ 3814.918070] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3814.918076] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3815.001361] usb 1-1.2: new high-speed USB device number 42 using xhci_hcd [ 3815.110184] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 [ 3815.110189] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3815.110763] usbtest 1-1.2:1.0: FX2 device [ 3815.110770] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3815.278974] usbtest 1-1.2:1.0: FX2 device [ 3815.278980] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3815.441659] usb 1-1.2: USB disconnect, device number 42 [ 3816.945718] usb 1-1.2: new high-speed USB device number 43 using xhci_hcd [ 3822.029925] usb 1-1.2: device descriptor read/64, error -110 [ 3837.646397] usb 1-1.2: device descriptor read/64, error -110 [ 3837.834166] usb 1-1.2: new high-speed USB device number 44 using xhci_hcd [ 3843.022296] usb 1-1.2: device descriptor read/64, error -110 [ 3858.639026] usb 1-1.2: device descriptor read/64, error -110 [ 3858.747197] usb 1-1-port2: attempt power cycle [ 3859.351073] usb 1-1.2: new high-speed USB device number 45 using xhci_hcd [ 3864.527295] usb 1-1.2: device descriptor read/64, error -110 [ 3880.143241] usb 1-1.2: device descriptor read/64, error -110 [ 3880.335203] usb 1-1.2: new high-speed USB device number 46 using xhci_hcd [ 3885.519232] usb 1-1.2: device descriptor read/64, error -110 [ 3893.338085] usb 1-1: USB disconnect, device number 40 [ 3893.338105] usb 1-1-port2: cannot reset (err = -71) [ 3893.338207] usb 1-1.1: USB disconnect, device number 41 [ 3903.639160] usb 1-1: new high-speed USB device number 47 using xhci_hcd [ 3903.787120] usb 1-1: New USB device found, idVendor=0424, idProduct=2512, bcdDevice= b.b3 [ 3903.787126] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3903.788563] hub 1-1:1.0: USB hub found [ 3903.788623] hub 1-1:1.0: 2 ports detected [ 3904.075163] usb 1-1.1: new high-speed USB device number 48 using xhci_hcd [ 3904.179572] usb 1-1.1: New USB device found, idVendor=08a9, idProduct=0015, bcdDevice= 4.d2 [ 3904.179578] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3904.258905] usb 1-1.2: new high-speed USB device number 49 using xhci_hcd [ 3904.359463] usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 [ 3904.359468] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3904.359910] usbtest 1-1.2:1.0: FX2 device [ 3904.359917] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3905.281385] usbtest 1-1.2:1.0: FX2 device [ 3905.281391] usbtest 1-1.2:1.0: high-speed {control bulk-in bulk-out} tests (+alt) [ 3905.298466] usb 1-1.2: USB disconnect, device number 49 [ 3907.055157] usb 1-1.2: new high-speed USB device number 50 using xhci_hcd [ 3912.143182] usb 1-1.2: device descriptor read/64, error -110 [ 3927.758882] usb 1-1.2: device descriptor read/64, error -110 [ 3927.947125] usb 1-1.2: new high-speed USB device number 51 using xhci_hcd [ 3933.135627] usb 1-1.2: device descriptor read/64, error -110 [ 3948.751220] usb 1-1.2: device descriptor read/64, error -110 [ 3948.859284] usb 1-1-port2: attempt power cycle [ 3949.463162] usb 1-1.2: new high-speed USB device number 52 using xhci_hcd [ 3954.639193] usb 1-1.2: device descriptor read/64, error -110 [ 3970.255232] usb 1-1.2: device descriptor read/64, error -110 [ 3970.443189] usb 1-1.2: new high-speed USB device number 53 using xhci_hcd [ 3975.631231] usb 1-1.2: device descriptor read/64, error -110 [ 3991.247280] usb 1-1.2: device descriptor read/64, error -110 [ 3991.355230] usb 1-1-port2: unable to enumerate USB device

Regarding schematic - I'm not 100% sure if it's the one you've noted. It still misses few components, such as bridging resistors (in case of single EEPROM used for both FX2) and jumpers for EEPROMs write protection and SDA comms to FX2 chips. ADCs are TLC5510, not AD9283. The device I have is this one: https://sigrok.org/wiki/HT_USBee-DxPro Apart from couple missing capacitors and board version label I could not find any difference from https://sigrok.org/wiki/XZL_Studio_DX This one looks closer to what I have: http://kazus.ru/forums/attachment.php?attachmentid=14244&d=1288617310

Deusex25 commented 4 years ago

I have also buzzed the board, regarding the ADC clocking. The bad news are that you are right: ADC clock is coming from LA. The good news are that it is possible to cut the line from LA, and small bridge from IC to ADC clock line. I traced it. It passes very close to scope FX2 and has some uncovered vias.

Ho-Ro commented 4 years ago

New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01 ... New USB device found, idVendor=04b4, idProduct=6022, bcdDevice= 0.00 ...

I looked at the dmesg log and see that the "scope FX2" always crashes regardless if an EEPROM is available or not. This is strange as with default ID my FX2 devel board starts without any issue. Looking at the schematics shows two connections that can cause the trouble: You could investigate what happens with the connection from pin 12 of the hub device (PRTPWR1) to pin 49 of the scope FX2 (RESET#). Also the connection from PA1 of the scope FX2 device to RESET# of the LA FX2 looks suspect, because the Hantek6022 firmware sets PA to zero and resets the other FX2.

This line is ok because the kernel driver usbtest.ko is bound to the "naked" FX2 in order to support development - it is datached later.

Did you try the python bindings in this repo? The examples directory has some programs that allow to do smaller test steps, e.g. upload_firmware.py, you can also try different firmware versions. You need to install the bindings with make install in order to use it correctly. Also the tool fxload can help, it is available as a distro package.

BTW: which system do you use?

Ho-Ro commented 4 years ago

A small update (034f169) allows the hex file upload to devices with user defined VID:PID, have a look at the example. In combination with the fx2eeprom repo you're also able to read and write the EEPROM content after uploading the vend_ax.hex file.

Deusex25 commented 4 years ago

Will check ASAP.

Ho-Ro commented 4 years ago

... or use this quick tool: 402d7c4

Ho-Ro commented 3 years ago

more than one year ago:

Will check ASAP.

closed