Rigol DG800 usbtmc workaround? - Page 1
Forum section: electronics / testgear

author: Siwastaja
author_rank: Super Contributor
timestamp: April 15, 2025, 02:27:23 pm
content: Hi,Trying to connect to Rigol DG822 as USB device on linux. Interested in reading out the frequency counter value. Getting commands to the FG (OUTP ON etc.) just fine, but getting absolutely nothing back, not to *IDN? let alone :COUN:MEAS?. Googling reveals that Rigol has failed the firmware and it's not even supposed to work depending on the USB controller of the host PC (supposedly it uses illegal USB packet length, sayshttps://www.teuniz.net/DSRemote/), but that there might be or might not be workaround(s), however the issue seems ungooglable further than that. Not interested in full-blown debug work or designing work-arounds myself or writing linux kernel modules, spending max 1 day on this and half of it is already gone, after that it's cheaper to buy a non-broken FG.I can verify correct reaction to commands, but absence of any responses in three different ways:1) Simple: echo "*IDN?" > /dev/usbtmc0; cat /dev/usbtmc02) This python projecthttps://gist.github.com/pklaus/25970493) This C projecthttps://github.com/ralfstx/rigol-linuxBut before I give up, does anyone remember if this issue was ever resolved in any way, no matter how ugly workaround it might be? I mean, someonemusthave successfully interfaced with Rigol devices, including the FGs, right?

author: Fenstergucker
author_rank: Regular Contributor
timestamp: April 15, 2025, 02:51:56 pm
content: I am trying to switch from Windows to Linux, and have therefore also compiled my program 'Messinstrumente-Skript' for Linux. The link to the website is in my profile.The program uses the libusb-1 library and I programmed the USBTMC protocol myself. I can use it to control my Rigol devices such as the DG4000.I have created the file '/etc/udev/rules.d/99-usb.rules' with the following line under Linux Mint:SUBSYSTEMS=="usb", ACTION=="add", MODE="0664", GROUP="plugdev"Perhaps you can use the program to test whether the connection works.Here is an example script:Code:instrument usbtmc 1AB1 0641 // Adapt product ID.string IDNIDN function scpi read *IDN?print IDN: $IDNfunction message "/$IDN" ok informationPeter

author: Fenstergucker
author_rank: Regular Contributor
timestamp: April 15, 2025, 03:47:30 pm
content: I also remember that I have problems with the DG4000 when I use a USB 3 port. Maybe this is also a problem for you. I now use a small USB 2 hub just for the DG4000.Peter

author: Siwastaja
author_rank: Super Contributor
timestamp: April 15, 2025, 03:54:14 pm
content: Nice piece of software you have. It says:"Script error: The instrument was not found and no connection could be established."With:instrument usbtmc 1AB1 0643Output of lsusb isBus 003 Device 011: ID 1ab1:0643 Rigol Technologies DG800

author: Fenstergucker
author_rank: Regular Contributor
timestamp: April 15, 2025, 04:00:35 pm
content: When you open the log window 'Help->Log', is the version of libusb-1 displayed at the beginning? If it only says 'Error:', it is not installed.Peter

author: Siwastaja
author_rank: Super Contributor
timestamp: April 15, 2025, 05:14:50 pm
content: 0002 [20:12:16] LibUsb version: 1.0.23.11397http://libusb.infoSo I guess I have to look at downgrading the USB port into USB2.0 full speed or something.

author: Siwastaja
author_rank: Super Contributor
timestamp: April 15, 2025, 05:56:59 pm
content: This is the problem exactly:Code:[ 1591.490814] usbtmc 3-8:1.0: Device sent reply with wrong MsgID: 82 != 2[ 1592.405059] usbtmc 3-8:1.0: Device sent reply with wrong bTag: 4 != 6Also this does not work on either of my two laptops I tested with:https://www.systutorials.com/how-to-force-a-usb-3-0-port-to-work-in-usb-2-0-mode-in-linux/(It keeps enumerating using xhci even when those register writes to USB host controller succeed.)Could try with old enough USB hub not to support even high-speed USB... That would need to be something before 2005 or so. Wow. The function generator I bought in 2020.

author: thm_w
author_rank: Super Contributor
timestamp: April 15, 2025, 10:33:10 pm
content: If you happen to have the correct USB to RJ45 adapter on hand, you can use that:https://www.eevblog.com/forum/testgear/new-rigol-16-bit-function-generators-dg800900-series/msg3272106/#msg3272106Or buy for a few dollars.Are you just going to be measuring frequency as end goal, or is this going to be a more advanced project?

author: Siwastaja
author_rank: Super Contributor
timestamp: April 16, 2025, 05:58:04 am
content: Quote from: thm_w on April 15, 2025, 10:33:10 pmJust going to measure frequency with a non-DIY instrument which comes with a datasheet and accuracy of preferably within +/-2mHz at 50Hz, and update rate (averaging/edge counting period) of 0.5 seconds or less. I know there are plenty of frequency counters to buy even in sub $500 class, but wanted to try quickly with something I already had lying around. But it seems quick tests are never quick...

author: RoGeorge
author_rank: Super Contributor
timestamp: April 16, 2025, 07:13:28 am
content: Using LAN instead of USB would be better (LAN has galvanic isolation between the PC and the instrument), but if you must use an USB connection, IIRC the Rigol implementation of USB was working from Windows, so maybe the easiest fix would be to use a virtual machine running Windows (e.g. from VirtualBox), and control the instrument from Windows.