Giter Club home page Giter Club logo

hantek6022api's People

Contributors

baruch avatar bmecke avatar f1rmb avatar ho-ro avatar jhoenicke avatar lambertdw avatar michalfapso avatar rpcope1 avatar stapelberg avatar zagrodzki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hantek6022api's Issues

calibrate_6022.py fails with python 3.9

Apparently tostring for array.array was removed with python 3.9:
https://docs.python.org/3.9/whatsnew/3.9.html#removed

Hantek6022API/examples$ python3 calibrate_6022.py 
Traceback (most recent call last):
  File "/Users/martin/Documents/200_projekte/Hantek6022API/examples/calibrate_6022.py", line 21, in <module>
    from PyHT6022.LibUsbScope import Oscilloscope
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/LibUsbScope.py", line 12, in <module>
    from PyHT6022.Firmware import dso6022be_firmware, dso6022bl_firmware, fx2_ihex_to_control_packets
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/Firmware/__init__.py", line 41, in <module>
    stock_firmware = fx2_ihex_to_control_packets(os.path.join(base_path, 'stock', 'stock_fw.ihex'))
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/Firmware/__init__.py", line 30, in fx2_ihex_to_control_packets
    packets.append(FirmwareControlPacket(record_len, addr, array.array('B', record_data).tostring()))
AttributeError: 'array.array' object has no attribute 'tostring'

Support for USBee-DX clone

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.

Linux: Can't compile with sdcc 3.9.0

Cannot compile when using the newest version of sdcc (3.9.0).

The following error appears:

cd PyHT6022/HantekFirmware/custom_BE && make
make[1]: Entering directory '/media/home/user/SourceCode/Sources/Hantek6022API/PyHT6022/HantekFirmware/custom_BE'
mkdir -p build
make -C ../fx2lib/lib
make[2]: Entering directory '/media/home/user/SourceCode/Sources/Hantek6022API/PyHT6022/HantekFirmware/fx2lib/lib'
sdcc -mmcs51  -I../include -c serial.c -o serial.rel
sdcc -mmcs51  -I../include -c i2c.c -o i2c.rel
sdcc -mmcs51  -I../include -c delay.c -o delay.rel
sdcc -mmcs51  -I../include -c setupdat.c -o setupdat.rel
sdcc -mmcs51  -I../include -c gpif.c -o gpif.rel
sdcc -mmcs51  -I../include -c eputils.c -o eputils.rel
sdcc -mmcs51  -I../include -c interrupts/spare_isr.c -o interrupts/spare_isr.rel
sdcc -mmcs51  -I../include -c interrupts/usbreset_isr.c -o interrupts/usbreset_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6_isr.c -o interrupts/ep6_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4ef_isr.c -o interrupts/ep4ef_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep0out_isr.c -o interrupts/ep0out_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6ping_isr.c -o interrupts/ep6ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4ff_isr.c -o interrupts/ep4ff_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4ping_isr.c -o interrupts/ep4ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep1out_isr.c -o interrupts/ep1out_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2ping_isr.c -o interrupts/ep2ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2ef_isr.c -o interrupts/ep2ef_isr.rel
sdcc -mmcs51  -I../include -c interrupts/errlimit_isr.c -o interrupts/errlimit_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4isoerr_isr.c -o interrupts/ep4isoerr_isr.rel
sdcc -mmcs51  -I../include -c interrupts/gpifwf_isr.c -o interrupts/gpifwf_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4_isr.c -o interrupts/ep4_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6isoerr_isr.c -o interrupts/ep6isoerr_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8_isr.c -o interrupts/ep8_isr.rel
sdcc -mmcs51  -I../include -c interrupts/suspend_isr.c -o interrupts/suspend_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8ff_isr.c -o interrupts/ep8ff_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8isoerr_isr.c -o interrupts/ep8isoerr_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2pf_isr.c -o interrupts/ep2pf_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8ef_isr.c -o interrupts/ep8ef_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep0in_isr.c -o interrupts/ep0in_isr.rel
sdcc -mmcs51  -I../include -c interrupts/gpifdone_isr.c -o interrupts/gpifdone_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep0ping_isr.c -o interrupts/ep0ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep1in_isr.c -o interrupts/ep1in_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8ping_isr.c -o interrupts/ep8ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/sof_isr.c -o interrupts/sof_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep0ack_isr.c -o interrupts/ep0ack_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2ff_isr.c -o interrupts/ep2ff_isr.rel
sdcc -mmcs51  -I../include -c interrupts/sudav_isr.c -o interrupts/sudav_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep1ping_isr.c -o interrupts/ep1ping_isr.rel
sdcc -mmcs51  -I../include -c interrupts/sutok_isr.c -o interrupts/sutok_isr.rel
sdcc -mmcs51  -I../include -c interrupts/hispeed_isr.c -o interrupts/hispeed_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2isoerr_isr.c -o interrupts/ep2isoerr_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6ff_isr.c -o interrupts/ep6ff_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep2_isr.c -o interrupts/ep2_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ibn_isr.c -o interrupts/ibn_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep8pf_isr.c -o interrupts/ep8pf_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6ef_isr.c -o interrupts/ep6ef_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep6pf_isr.c -o interrupts/ep6pf_isr.rel
sdcc -mmcs51  -I../include -c interrupts/ep4pf_isr.c -o interrupts/ep4pf_isr.rel
sdas8051 -logs usbav.a51
sdas8051 -logs int4av.a51
sdcclib fx2.lib serial.rel i2c.rel delay.rel setupdat.rel gpif.rel eputils.rel interrupts/spare_isr.rel interrupts/usbreset_isr.rel interrupts/ep6_isr.rel interrupts/ep4ef_isr.rel interrupts/ep0out_isr.rel interrupts/ep6ping_isr.rel interrupts/ep4ff_isr.rel interrupts/ep4ping_isr.rel interrupts/ep1out_isr.rel interrupts/ep2ping_isr.rel interrupts/ep2ef_isr.rel interrupts/errlimit_isr.rel interrupts/ep4isoerr_isr.rel interrupts/gpifwf_isr.rel interrupts/ep4_isr.rel interrupts/ep6isoerr_isr.rel interrupts/ep8_isr.rel interrupts/suspend_isr.rel interrupts/ep8ff_isr.rel interrupts/ep8isoerr_isr.rel interrupts/ep2pf_isr.rel interrupts/ep8ef_isr.rel interrupts/ep0in_isr.rel interrupts/gpifdone_isr.rel interrupts/ep0ping_isr.rel interrupts/ep1in_isr.rel interrupts/ep8ping_isr.rel interrupts/sof_isr.rel interrupts/ep0ack_isr.rel interrupts/ep2ff_isr.rel interrupts/sudav_isr.rel interrupts/ep1ping_isr.rel interrupts/sutok_isr.rel interrupts/hispeed_isr.rel interrupts/ep2isoerr_isr.rel interrupts/ep6ff_isr.rel interrupts/ep2_isr.rel interrupts/ibn_isr.rel interrupts/ep8pf_isr.rel interrupts/ep6ef_isr.rel interrupts/ep6pf_isr.rel interrupts/ep4pf_isr.rel usbav.rel int4av.rel
make[2]: sdcclib: Command not found
make[2]: *** [Makefile:27: fx2.lib] Error 127
make[2]: Leaving directory '/media/home/user/SourceCode/Sources/Hantek6022API/PyHT6022/HantekFirmware/fx2lib/lib'
make[1]: *** [fx2.mk:80: ../fx2lib/lib/fx2.lib] Error 2
make[1]: Leaving directory '/media/home/user/SourceCode/Sources/Hantek6022API/PyHT6022/HantekFirmware/custom_BE'
make: *** [Makefile:9: fw_custom_BE] Error 2

The reason is apparently that sdcclib was removed from sdcc:

2019-02-07 Philipp Klaus Krause <pkk AT spth.de>

	* .version,
	  Makefile.in,
	  configure,
	  configure.ac,
	  doc/sdccman.lyx:
	  Remove sdcclib.
	* sim/ucsim/sim.src/var.cc,
	  sim/ucsim/sim.src/varcl.h,
	  sim/ucsim/stm8.src/glob.cc,
	  sim/ucsim/stm8.src/stm8.cc:
	  stm8 simulator fixes, patches by Mike Jagdis.

(Source: http://svn.code.sf.net/p/sdcc/code/trunk/sdcc/ChangeLog )

Downgrading to sdcc 3.8.0 solves the issue.

10bit support

Just wondering if you may have an idea how to get this software to support 10bit mode on the 6022. I see that the Hscope Android app can put the 6022 into a 10bit mode. It would be particularly nice in the PyQt5 app I'm building. This is an app that does an engine relative compression test using the CC-650 amp clamp. 10bit mode would give my app much better accuracy.

BTW, thanks for supporting the 6022 with Python. I expect that I'll be using it quite a bit in the future.

Missing pulses when calibration freq is set to 100kHz

Mentioned there by @iss000:
The problem is missing pulses when calibration freq is set to 100kHz (every lower freq is OK).
image

The calibration pulse is created via timer2_isr() (source):

void timer2_isr( void ) __interrupt TF2_ISR {
    /* Toggle the probe calibration pin. */
    TOGGLE_CALIBRATION_PIN();
#ifdef LED_RED_TOGGLE
    if ( ledcounter && --ledcounter == 0 ) { // led timed out
        ledcounter = ledinit;                // reload
        LED_RED_TOGGLE();
    }
#endif
    TF2 = 0;
}

The timer is initialized in set_calibration_pulse() (source):

static BOOL set_calibration_pulse( BYTE freq ) {
    long frequency; // calibration frequency in Hz (32..100k)
...
    ledinit = frequency / 2;
    long rcap = -2e6L / frequency;
    RCAP2L = rcap & 0xff;
    RCAP2H = ( rcap & 0xff00 ) >> 8;
    return TRUE;
}

Debian buster version:

   1 ;--------------------------------------------------------
   2 ; File Created by SDCC : free open source ANSI-C Compiler
   3 ; Version 3.8.0 #10562 (Linux)
   4 ;--------------------------------------------------------
   5 	.module dso6022be
   6 	.optsdcc -mmcs51 --model-small
   7
...
1204 ;------------------------------------------------------------
1205 ;Allocation info for local variables in function 'timer2_isr'
1206 ;------------------------------------------------------------
1207 ;	scope6022.inc:76: void timer2_isr( void ) __interrupt TF2_ISR {
1208 ;	-----------------------------------------
1209 ;	 function timer2_isr
1210 ;	-----------------------------------------
1211 _timer2_isr:
1212 	push	acc
1213 	push	psw
1214 ;	scope6022.inc:78: TOGGLE_CALIBRATION_PIN();
1215 	cpl	_PA7
1216 ;	scope6022.inc:80: if ( ledcounter && --ledcounter == 0 ) { // led timed out
1217 	mov	a,_ledcounter
1218 	orl	a,(_ledcounter + 1)
1219 	jz	00108$
1220 	dec	_ledcounter
1221 	mov	a,#0xff
1222 	cjne	a,_ledcounter,00121$
1223 	dec	(_ledcounter + 1)
1224 00121$:
1225 	mov	a,_ledcounter
1226 	orl	a,(_ledcounter + 1)
1227 	jnz	00108$
1228 ;	scope6022.inc:81: ledcounter = ledinit;                // reload
1229 	mov	_ledcounter,_ledinit
1230 	mov	(_ledcounter + 1),(_ledinit + 1)
1231 ;	scope6022.inc:82: LED_RED_TOGGLE();
1232 	cpl	_PC0
1233 ;	assignBit
1234 	setb	_PC1
1235 00108$:
1236 ;	scope6022.inc:85: TF2 = 0;
1237 ;	assignBit
1238 	clr	_TF2
1239 ;	scope6022.inc:86: }
1240 	pop	psw
1241 	pop	acc
1242 	reti
1243 ;	eliminated unneeded mov psw,# (no regs used in bank)
1244 ;	eliminated unneeded push/pop dpl
1245 ;	eliminated unneeded push/pop dph
1246 ;	eliminated unneeded push/pop b

Debian bullseye version

   1 ;--------------------------------------------------------
   2 ; File Created by SDCC : free open source ANSI-C Compiler
   3 ; Version 4.0.0 #11528 (Linux)
   4 ;--------------------------------------------------------
   5 	.module dso6022be
   6 	.optsdcc -mmcs51 --model-small
   7
...
1198 ;------------------------------------------------------------
1199 ;Allocation info for local variables in function 'timer2_isr'
1200 ;------------------------------------------------------------
1201 ;	scope6022.inc:76: void timer2_isr( void ) __interrupt TF2_ISR {
1202 ;	-----------------------------------------
1203 ;	 function timer2_isr
1204 ;	-----------------------------------------
1205 _timer2_isr:
1206 	push	acc
1207 	push	ar7
1208 	push	ar6
1209 	push	psw
1210 	mov	psw,#0x00
1211 ;	scope6022.inc:78: TOGGLE_CALIBRATION_PIN();
1212 	cpl	_PA7
1213 ;	scope6022.inc:80: if ( ledcounter && --ledcounter == 0 ) { // led timed out
1214 	mov	a,_ledcounter
1215 	orl	a,(_ledcounter + 1)
1216 	jz	00108$
1217 	mov	a,_ledcounter
1218 	add	a,#0xff
1219 	mov	r6,a
1220 	mov	a,(_ledcounter + 1)
1221 	addc	a,#0xff
1222 	mov	r7,a
1223 	mov	_ledcounter,r6
1224 	mov	(_ledcounter + 1),r7
1225 	mov	a,r6
1226 	orl	a,r7
1227 	jnz	00108$
1228 ;	scope6022.inc:81: ledcounter = ledinit;                // reload
1229 	mov	_ledcounter,_ledinit
1230 	mov	(_ledcounter + 1),(_ledinit + 1)
1231 ;	scope6022.inc:82: LED_RED_TOGGLE();
1232 	cpl	_PC0
1233 ;	assignBit
1234 	setb	_PC1
1235 00108$:
1236 ;	scope6022.inc:85: TF2 = 0;
1237 ;	assignBit
1238 	clr	_TF2
1239 ;	scope6022.inc:86: }
1240 	pop	psw
1241 	pop	ar6
1242 	pop	ar7
1243 	pop	acc
1244 	reti
1245 ;	eliminated unneeded push/pop dpl
1246 ;	eliminated unneeded push/pop dph
1247 ;	eliminated unneeded push/pop b

As an intermediate containment action I reverted to the buster version of SDCC and set it on hold, see 81f6913:

the bullseye package (ver. 4.0.0) produces slower firmware code
that leads to jitter of the 100 kHz calibration signal.
workaround:
install buster packages from sdcc_debian_old/sdcc_3.8.0.tgz with:
"sudo apt install sdcc*_3.8.0*.deb"
and set them to hold:
"apt-mark hold sdcc; apt-mark hold sdcc-libraries"

Problems running calibration file

Hello!

Unable to run calibration file on Windows.
Perform everything according to the instructions:

  • Installed by Python 3.8.9;
  • Extract libusb-1.0.dll from the zip file into {Python install dir};
  • Installed Hantek6022API using the "setup.py install" command.

I started calibration.py and got errors (I attach screenshots).
How to fix it?
image

image

Debian 10 UnboundLocalError: local variable 'skip1st' referenced before assignment

I installed hantek6022api_2.10.3-1_all.deb on a debian 10 system but when launching capture_6022.py it got a backtrace "UnboundLocalError: local variable 'skip1st' referenced before assignment" :

$ capture_6022.py -r 200 -t 0.1 
Capturing 0.1 seconds ...    Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "/usr/lib/python3/dist-packages/usb1/__init__.py", line 408, in __callbackWrapper
    callback(self)
  File "/usr/lib/python3/dist-packages/PyHT6022/LibUsbScope.py", line 688, in transfer_callback
    callback(data[::2], data[1::2])
  File "/usr/bin/capture_6022.py", line 152, in pcb
    if skip1st: # skip the 1st (unstable) block
UnboundLocalError: local variable 'skip1st' referenced before assignment
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "/usr/lib/python3/dist-packages/usb1/__init__.py", line 408, in __callbackWrapper
    callback(self)
  File "/usr/lib/python3/dist-packages/PyHT6022/LibUsbScope.py", line 688, in transfer_callback
    callback(data[::2], data[1::2])
  File "/usr/bin/capture_6022.py", line 152, in pcb
    if skip1st: # skip the 1st (unstable) block
UnboundLocalError: local variable 'skip1st' referenced before assignment
...

Fixed by adding a global statement:

# diff -u /usr/bin/capture_6022.py~ /usr/bin/capture_6022.py
--- /usr/bin/capture_6022.py~	2022-03-21 18:51:47.000000000 +0100
+++ /usr/bin/capture_6022.py	2022-07-28 20:56:26.723450178 +0200
@@ -135,6 +135,7 @@
 # scale the data packets and write them into the outfile
 #
 def pcb( ch1_data, ch2_data ):
+    global skip1st,totalsize,dc1,dc2,rms1,rms2,timestep,start_time
     # define "static" variables
     if 'av1' not in pcb.__dict__:
         pcb.av1 = 0

Installation on Windows

This should bring the discussion to the right repo - combining OpenHantek/OpenHantek6022#83 and OpenHantek/openhantek#213
I would like to gather your experience to get an easy step-by-step Windows installation guide.

@justlep wrote:

I wasn't aware of those calibration hints - thank you for the link!
It's been some struggle for me with zero Python experience, but I got it working eventually.
Just in case someone else ever wants to calibrate his/her Hantek 6022BE on a Windows 10 machine, here is what I did:
install Python3
get the required libusb-1.0.dll file:
download the v1.0.23 zip from
https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.23/
extract libusb-1.0.dll from the zip file into {Python install dir}/
(where python.exe sits)

I think that libusb should be installed correctly, so the file `libusb-1.0.dll' is in a globally accessible directory. Not sure if Zadig could help here?

prepare Hantek6022API:

git clone https://github.com/Ho-Ro/Hantek6022API
cd Hantek6022API
pip install .

when I tried to run the calibration at this point, Python complained about missing firmware files.
I could solve this by copying the whole Hantek6022API\PyHT6022\HantekFirmware folder to
{Python install dir}\Lib\site-packages\PyHT6022\HantekFirmware

I made some changes to the firmware directories with e497692 - after installing on my bare-bone virtual W7 the FW files were available, but due to problems with the virtual installation I could not check the USB installation/communication. I would appreciate it if someone could check on a real W7 and W10.

run the calibration:

cd examples
calibrate_6022.py -gec

I was then able to calibrate the scope providing the given voltages.
All works perfectly fine now and voltage readings are nicely accurate.
Again, many many thanks for your work! :-)

A big thank you to @justlep and @Maddo534 for testing!

installation on Windows fails

Trying to install this package on Windows fails with ValueError: path '/usr/bin/' cannot be absolute
Probably related to setup.py:

Hantek6022API/setup.py

Lines 30 to 45 in 5d434c2

data_files=[
("/usr/bin/", ["examples/calibrate_6022.py",
"examples/capture_6022.py",
"examples/plot_from_capture_6022.py",
"examples/fft_from_capture_6022.py",
"examples/fft_ft_from_capture_6022.py",
"examples/set_cal_out_freq_6022.py",
"examples/upload_6022_firmware_from_hex.py",
"examples/upload_6022_firmware.py",
"fx2upload/fx2upload"]
),
("/usr/share/doc/hantek6022api/", ["README.md"]),
("/usr/share/doc/hantek6022api/", ["CHANGELOG"]),
("/usr/share/doc/hantek6022api/", ["LICENSE"]),
("/etc/udev/rules.d/", ["udev/60-hantek6022api.rules"]),
]

Windows installation problem

setup.py is not working in windows. I take in the following error.

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "D:\Hantek6022API\setup.py", line 20, in <module>
      setup(
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py", line 61, in run
      return orig.install.run(self)
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\command\install.py", line 558, in run
      self.run_command(cmd_name)
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\command\install_data.py", line 56, in run
      dir = convert_path(f[0])
    File "c:\users\administrator\appdata\local\programs\python\python39\lib\distutils\util.py", line 125, in convert_path
      raise ValueError("path '%s' cannot end with '/'" % pathname)
  ValueError: path 'share/doc/hantek6022api/' cannot end with '/'
  [end of output]

I changed setup.py in the following and it is working now. I just removed "/" in "share/doc/hantek6022api/". I think you should change this line for windows.

data_files=[
( 'share/doc/hantek6022api', [ 'README.md', 'CHANGELOG', 'LICENSE' ] ),
]

build instructions not correct for linux

The instructions have:

=======

You need to compile the custom firmware. Install sdcc for this. Then run make in the directory HantekFirmware/custom:

git submodule update --init
sudo apt-get install sdcc
cd PyHT6022/HantekFirmware/custom
make
Install the python modules and the firmware (e.g. into /usr/local/lib/python3.5/dist-packages/Python-Hantek...).

sudo python3 setup.py install
The provided Makefile simplifies the steps above a little bit

Build the firmware:

make fw_custom
Install modules and firmware:

======

The cd PyHT6022/HantekFirmware/custom directory does not exist. Do you mean custome_BE for the 60222BE?

I was then able to build in custome_BE, but failed with
sudo python3 setup.py install
I found setup.py in the top level directory (need to add a cd back to the top in the instructions), but the install failed with:

[bjbeare@bjbeare-desktop custom_BE]$ find . -name setup.py
[bjbeare@bjbeare-desktop custom_BE]$ cd -
/home/bjbeare/HanTek/Hantek6022API
[bjbeare@bjbeare-desktop Hantek6022API]$ find . -name setup.py
./setup.py
./PyHT6022/HantekFirmware/fx2lib/examples/fx2/setup.py
[bjbeare@bjbeare-desktop Hantek6022API]$ sudo python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

Precision is lost due to formatting at capture_6022.py

After running python capture.py -t 12 -r 20 (win 10), this is the output:

9.99982   , -0.06558  , -0.06786  
9.99984   ,  0.03635  ,  0.04169  
9.99986   ,  0.08339  ,  0.09647  
9.99988   ,  0.01283  ,  0.01822  
9.9999    , -0.08126  , -0.08351  
9.99992   , -0.06558  , -0.06786  
9.99994   ,  0.03635  ,  0.04169  
9.99996   ,  0.08339  ,  0.09647  
9.99998   ,  0.01283  ,  0.01822  
10        , -0.08126  , -0.08351  
10        , -0.05774  , -0.06786  
10        ,  0.03635  ,  0.04169  
10.0001   ,  0.08339  ,  0.09647  
10.0001   ,  0.01283  ,  0.01822  
10.0001   , -0.08126  , -0.08351  
10.0001   , -0.06558  , -0.06786  
10.0001   ,  0.03635  ,  0.04169  
10.0002   ,  0.08339  ,  0.09647  
10.0002   ,  0.01283  ,  0.01822  
10.0002   , -0.08126  , -0.08351  
10.0002   , -0.06558  , -0.06786  
10.0002   ,  0.03635  ,  0.04169  
10.0003   ,  0.08339  ,  0.09647  

Notice that in the first column, the time column, the steps before 10s are of 0.00002 seconds, which is consistent with the 1/sampling rate. After 10s, there are 5 consecutives values and the jumps are of 0.0001. This shows that one digit is lost when the comma has to move one place to the right.

To prevent this, I would suggest that the formatting directive at capture_6022.py changes from this:

outfile.write( "{:<10.6g}, {:< 10.4g}, {:< 10.4g}\n".format( pcb.timestep, ch1_value, ch2_value ) )

to this:

outfile.write( "{:<10.5f}, {:< 10.4g}, {:< 10.4g}\n".format( pcb.timestep, ch1_value, ch2_value ) )

The float only needs 5 numbers after the comma because 0.00001 is the minimum timestep at the maximum sampling rate which is 100000.

Thanks for the great work!

Idea(s) to realise a reliable sampling with 48MS/s.

The discussion started at OpenHantek/OpenHantek6022#60 and should also be followed there; this issue only serves as a link to retain the info.
Short summary:

  • Isochronous mode is not a solution for continuous scanning, as this mode is limited to ~24MB/s by the inherent system limitations.
  • Bulk mode for continuous scanning works fairly reliably up to 30 MB/s, (perhaps 40 MB/s, see Maximizing Transfer Rate with the FX2/FX2LP).
  • Sample a short block (4K samples) at high speed (48MS/s) into the FIFO and bulk (or ISO?) transfer the data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.