22 December 2012

298. Hantek DSO 2250 USB with Openhantek on Debian Testing/Wheezy /Linux

Update 23 May 2013: Updated as per Peter Jeffris' suggestion (see below)/

UPDATE: this has been updated as per the developer's (Oliver Haag) recommendations (see first comment)

Original post:
I wanted to get Hantek DSO-2250 USB running on debian. I first tried openhantek 0.2.0 but it doesn't support the DSO-2250, so I ended up using the development version. I had to get the configure and Makefile.in files from another source though (see below).

I finally got the scope to work as shown below -- I primarily needed it for some work on NMR probes I did two years ago, but better late than never.

Probe set to X1

Probe set to X10


Before installing anything, on plugging in the oscilloscope we get:
dmesg
[10885.993061] usb 2-2: USB disconnect, device number 3
[10894.913984] usb 1-2: new high-speed USB device number 9 using ehci_hcd
[10895.046104] usb 1-2: New USB device found, idVendor=04b4, idProduct=2250
[10895.046117] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[10895.398887] usb 1-2: USB disconnect, device number 9
[10895.668190] usb 1-2: new high-speed USB device number 10 using ehci_hcd
[10895.800317] usb 1-2: New USB device found, idVendor=04b4, idProduct=2250
[10895.800330] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

lsusb
Bus 001 Device 010: ID 04b4:2250 Cypress Semiconductor Corp.

Openhantek

sudo apt-get install subversion autoconf automake build-essential unrar
cd ~/tmp
svn checkout http://svn.code.sf.net/p/openhantek/code/trunk openhantek-code
cd openhantek-code/
sudo apt-get install libqt4-dev libfftw3-dev qt4-qmake fxload libusb-1.0-0-dev libbfd-dev
cd openhantek/
qmake
make
sudo make install
cd ../openhantek-extractfw/
aclocal && autoconf && automake
./configure
make
wget http://www.hantek.com.cn/Product/32Driver/2250/Driver.rar
unrar x Driver.rar
UNRAR 4.10 freeware Copyright (c) 1993-2012 Alexander Roshal Extracting from Driver.rar Creating Driver OK Extracting Driver/DSO22501.sys OK Extracting Driver/DSO22502.sys OK Extracting Driver/dso2250usb.inf OK All OK
./openhantek-extractfw Driver/DSO22501.sys
BFD: Driver/DSO22501.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .text BFD: Driver/DSO22501.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .data Section .data found (starting at 0x08a0, 9504 bytes) Symbol _firmware found (offset 0x0000, 8184 bytes) Symbol _loader found (offset 0x1ff8, 1320 bytes) Saving firmware as Driver/dso2250-firmware.hex Saving loader as Driver/dso2250-loader.hex
sudo mkdir -p /usr/local/share/hantek sudo cp Driver/*.hex /usr/local/share/hantek/

While tempting (the ID shows up as 04b4 above), do NOT change the part marked in red in 90-hantek.rules since changing it requires you to run as root. It works fine as user if you leave it alone.
 13 # Hantek DSO-2250
 14 SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="4b4/2250/*", RUN+="/sbin/fxload -t fx2 -I /usr/local/share/hantek/dso2250-firmware.hex -s /usr/local/share/hantek/dso2250-loader.hex -D $env{DEVNAME}"
 15 SYSFS{idVendor}=="04b5", SYSFS{idProduct}=="2250", MODE="0660", GROUP="plugdev"
sudo cp 90-hantek.rules /etc/udev/rules.d/
sudo service udev restart
sudo usermod -a -G plugdev $USER

Plug in your oscilloscope:
[ 4216.277235] udevd[23240]: starting version 175
[ 4246.532221] usb 2-2: new high-speed USB device number 5 using ehci_hcd
[ 4246.664559] usb 2-2: New USB device found, idVendor=04b4, idProduct=2250
[ 4246.664570] usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 4246.718694] usb 2-2: USB disconnect, device number 5
[ 4248.492214] usb 2-2: new high-speed USB device number 6 using ehci_hcd
[ 4248.625224] usb 2-2: New USB device found, idVendor=04b5, idProduct=2250
[ 4248.625238] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4248.625246] usb 2-2: Product: DSO-2250 
[ 4248.625252] usb 2-2: Manufacturer: ODM

At this point the light on the oscilloscope was blinking red.
openhantek

Check the 'show spectrum' thingy (I'm running this with the probe on CH1 connected to the square wave cal at the back of the scope).

Done.

11 comments:

  1. The line of the udev rules file changed above should handle the permissions for the device after the firmware was loaded (Loading the firmware changes the ID). So the vendor ID 4b5 should be correct and allow to use it as normal user as long as you're in the plugdev group, let me know if you have problems.

    ReplyDelete
  2. Cheers Oliver! It works perfectly now with 04b5 and I can run as a regular user. And thank you for a great piece of software.

    ReplyDelete
  3. Hello,

    I'm trying to get openhantek and the DSO-2250 to work on Ubuntu 12.10, I can follow every step, but when plugged in the DSO does not blink red. If I open openhantek, the DSO blinks green, I can change voltage etc. and the DSO 'clicks' but nothing is never put on the screen and I get this error in the terminal:

    Getting sample data failed: Operation timed out

    Do you have any ideas to fix this?

    ReplyDelete
    Replies
    1. Oliver Haag (see above) would be the expert. All I can suggest is
      * try running openhantek as root and see if it changes anything
      * look at the dmesg output -- any hints?
      * what's the chip ID? Afaik all DSO-2250 use the same chip, but it's not unheard of for manufacturers to switch without renaming the model.
      * Have you tried using the exact same settings as shown in the screenshots for the acquisition? I think I had to play around a little bit before actually getting anything on screen.

      Good luck. You might also want to post on an ubuntu forum since other ubuntu users may have the same issue. If you do, post the link to your post here.

      Delete
  4. In order to get the configuration and makefiles you need to:
    $ apt-get install autoconfig automake
    $ aclocal autoconf autoheader automake --add-missing

    then you can run:
    $ ./configure
    $ make

    ReplyDelete
    Replies
    1. Peter, thank you for your suggestion.
      However, in my case
      aclocal autoconf autoheader automake --add-missing
      as written didn't work (no configure file). I had to run each command separately, then copy Makefile.in to Makefile.

      And autoheader gave
      autoheader: error: AC_CONFIG_HEADERS not found in configure.in

      Delete
    2. I've updated the instructions to use the autoconf/make method, and have fixed a couple of omissions.

      Delete
  5. Hi,

    does anyone know it the Hantek 6022BE is also working? Everything is compiling fine, but the extraction of the firmware does not work (I used the 6022BE files in this case).
    I don't wanted to change the id's and try to use the 2250 firmware before reading about it - but I didnot find anything about it... could that work, is ist probably the same chip used in this device?

    Cheers,

    Uli-G

    ReplyDelete
  6. Hello,

    I'm writing just because I think this can help someone. At least this comment would have helped me, which I struggled a bit to get my Hantek dso2250 working on my Ubuntu. The fact is that the link http://www.hantek.com.cn/Product/32Driver/2250/Driver.rar is not working anymore. So:
    wget http://www.usb-instruments.cn/download/driver/2250driver.zip
    unzip 2250driver.zip

    But please don't waste time downloading the driver from www.hantek.com, like I myself did the first time.
    It's different and probably updated and for some reason doesn't work with openhantek.

    ReplyDelete
  7. Thank you!!! This is the only way to get DSO-2250 working with Ubuntu 14.04 (32bits).

    The best tip here is to use the source:

    svn checkout http://svn.code.sf.net/p/openhantek/code/trunk openhantek-code

    The other sources from openhantek.org (GitHub) will not work!

    ReplyDelete
  8. Hello,
    first of all, thank you for the post, i had quite a bad time compiling from git and failing to complete qmake.I am compiling it on Raspbian GNU/Linux 8 and with your help at least the qmake is sucessfull. Now im stuck on make and i always get the following error:

    src/dsowidget.cpp: In member function ‘bool DsoWidget::exportAs()’:
    src/dsowidget.cpp:460:84: error: ‘class QFileDialog’ has no member named ‘selectedFilter’
    exporter.setFormat((ExportFormat) (EXPORT_FORMAT_PDF + filters.indexOf(fileDialog.selectedFilter())));
    ^
    Makefile:577: recipe for target 'build/obj/dsowidget.o' failed
    make: *** [build/obj/dsowidget.o] Error 1

    Any idea whats going wrong here?
    Any help would be appreciated!

    Cheers,

    Krunz

    ReplyDelete