SLO-scope and Unhandled exception

I just got my “Pololu USB AVR Programmer” and when I start the SLO-scope, I always get an error (see below).
BTW, I’m using Windows Vista Home Premium (64-bit) and the programing and the extra serial port work as it should.

What is the problem, and how can it be solved?


This is the error message:

   See the end of this message for details on invoking 
   just-in-time (JIT) debugging instead of this dialog box.
   ************** Exception Text **************
   System.Exception: Unexpected error (31).  Try cycling programmer power.
      at Pololu.Sloscope.checkErrors()
      at Pololu.Form1.GetMillivoltsPerCount(Int32 samples)
      at Pololu.Form1.Form1_Load(Object sender, EventArgs e)
      at System.Windows.Forms.Form.OnLoad(EventArgs e)
      at System.Windows.Forms.Form.OnCreateControl()
      at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
      at System.Windows.Forms.Control.CreateControl()
      at System.Windows.Forms.Control.WmShowWindow(Message& m)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
      at System.Windows.Forms.ContainerControl.WndProc(Message& m)
      at System.Windows.Forms.Form.WmShowWindow(Message& m)
      at System.Windows.Forms.Form.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   ************** Loaded Assemblies **************
       Assembly Version:
       Win32 Version: 2.0.50727.4206 (VistaSP2GDR.050727-4200)
       CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
       Assembly Version:
       Win32 Version:
       CodeBase: file:///C:/Users/Stefan/AppData/Local/Apps/2.0/JKEXD4H6.1JB/OCC7V0KJ.G5A/slos..tion_169a8ae48e8e5603_0001.0000_b426b3f4c1bff4be/sloscope.exe
       Assembly Version:
       Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
       CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/
       Assembly Version:
       Win32 Version: 2.0.50727.4205 (VistaSP2GDR.050727-4200)
       CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/
       Assembly Version:
       Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
       CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/
       Assembly Version:
       Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
       CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Deployment/
       Assembly Version:
       Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
       CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/
   ************** JIT Debugging **************
   To enable just-in-time (JIT) debugging, the .config file for this
   application or computer (machine.config) must have the
   jitDebugging value set in the section.
   The application must also be compiled with debugging
   For example:
       < jitDebugging="true" />
   When JIT debugging is enabled, any unhandled exception
   will be sent to the JIT debugger registered on the computer
   rather than be handled by this dialog box.


The problem is that the SLO-Scope application’s first call to WinUsb_ControlTransfer (a part of Windows) is returning an error. The error is 31, ERROR_GEN_FAILURE. This is an error that happens if we try to do a USB control transfer that the device does not support, but that is not the case here. We’ve also seen that USB hubs cause it to happen sometimes.

What happens if you run the Pololu USB AVR Programmer Configuration Utility (pgm03a_config.exe)? Can you connect to the programmer and read information from it?

Is there a USB hub between the programmer and the computer?


Yes, the programmer was connected to a USB hub, a “D-Link DUB-H7” (, and when I connect the programmer direct to the computer then everything work as expected.

Thanks, for the help.


I’m glad you got it working!

We have experienced a very similar problem with that same model of hub: