Author Topic: How to Debug digispark?  (Read 6338 times)

shawn

  • Newbie
  • *
  • Posts: 8
How to Debug digispark?
« on: December 21, 2012, 12:52:00 pm »
I've got the RGB hooked up and I'm running the DigiRGB.py script. It was working great until I decided to change the way the digispark worked based on the value given (transition slowly from one color to the next). For some reason after making a few changes it stopped working, I get a usb error below:

Traceback (most recent call last):
  File "C:\Users\schasse\Documents\My Dropbox\arduino-1.0.3\digiblink\DigiRGB.py", line 100, in
    theDevice.write(ord("s"))
  File "C:\Users\schasse\Documents\My Dropbox\arduino-1.0.3\digiblink\arduino\usbdevice.py", line 68, in write
    []) # ignored
  File "C:\Users\schasse\Documents\My Dropbox\arduino-1.0.3\digiblink\arduino\usbdevice.py", line 90, in _transfer
    value)
  File "C:\Python27\lib\site-packages\usb\core.py", line 695, in ctrl_transfer
    self.__get_timeout(timeout)
  File "C:\Python27\lib\site-packages\usb\backend\libusb01.py", line 523, in ctrl_transfer
    timeout
  File "C:\Python27\lib\site-packages\usb\backend\libusb01.py", line 384, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending control message failed, win error: The I/O operation has been aborted
because of either a thread exit or an application request.

Looks like the digispark is dying somehow when trying to change the color. If I knew how to debug the digispark itself then I could try to see where it is dying. Any advice?
« Last Edit: December 21, 2012, 12:52:00 pm by shawn »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
How to Debug digispark?
« Reply #1 on: December 21, 2012, 01:26:30 pm »
The DigisparkUSB library that is used for DigiBlink is actually designed for debugging - using a command line program like the Arduino serial monitor, which we will finish up and get out in the next week.

I\'m not sure that would help here though since the issue is with that USB communication. It\'d be like trying to debug a serial issue on the arduino using  the serial monitor.

One thing to keep in mind is the DigiUSB.refresh(); needs to be called at least every 5 to 10 ms, and ideally not more than every about 2ms, though you can get away with more. That function tells the computer the device is present, your error might be related to that.

I\'ll be happy to investigate specific things like this in more detail once we get a bit further along, but right now I\'m stretched a bit thin, I apologize for that.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
How to Debug digispark?
« Reply #2 on: December 21, 2012, 01:28:13 pm »

shawn

  • Newbie
  • *
  • Posts: 8
How to Debug digispark?
« Reply #3 on: December 21, 2012, 01:30:03 pm »
Thanks for the info, I figured out my specific problem, but I\'ll definitely be looking forward to the serial monitor in the future. Not sure if it would have helped. I was somehow setting a value to be either < 0 or > 255 and that was causing things to blow up.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
How to Debug digispark?
« Reply #4 on: December 21, 2012, 01:47:50 pm »
the value is transferred as a byte so it has to be 0-255 - for that current primitive version at least. - glad you got it worked out!