Author Topic: DigiCDC Randomly will Disappear from USB ls (Ubuntu 14.04)  (Read 4401 times)

TeamCirle

  • Newbie
  • *
  • Posts: 2
DigiCDC Randomly will Disappear from USB ls (Ubuntu 14.04)
« on: December 11, 2015, 09:14:57 am »
Hello Digistump community.  This is my first post here so please forgive me if I just jump right in. 

We are are Medical Device Incubator who is using the Digispark as a USB device for simple footpedal control and have a bug we cannot find a root cause for.  Any help would be much appreciated   :D

We are using the DigiCDC library to re-initialize the device as a serial device which is working fine.  The issue is this; randomly it will drop off of the USB device list and will no longer be recognized by the OS (Ubuntu 14.04).  Even when the OS and computer system is powered down (but not disconnected from power) the USB device will still not be recognized.  Only after power is completely disconnected from the motherboard or the Digispark completely removed will the state be corrected and the OS once again able to initialize the device as USB/Serial.

This seems to be a timing or a power cycle issue or a combination of both.  The device will be recognized 2 times by the OS: Once as a standard USB device, then will drop into a 'limbo' state for 1-2 seconds , then, secondly as a serial device.  This action assigns 2 device IDs on the same BUS (which it should) and presumably dumps the first ID when it re-initializes as a serial device.  Every so often on startup or over time (several hours), the device status will be "lost" by the OS and never recovered.  Only a complete power drain of the system will allow the digispark to correct. 

Has anyone seen or heard of this instance before?  We have not been able to consistently recreate the issue and therefor have not been able to identify a root cause.  Any hint as to how we may be able to avoid this 'limbo' state would be much appreciated.  Thank you.


Best Regards,
Carlos Velasquez

Ralf

  • Guest
Re: DigiCDC Randomly will Disappear from USB ls (Ubuntu 14.04)
« Reply #1 on: December 12, 2015, 02:35:13 am »
Hi Carlos,

I am no expert, but have been playing with Linux and VUSB gadgets like the digispark for a while.

My impression is, that the VUSB gadgets use too many tricks to be reliable enough for a professional project.

Especially the ones without a crystal oscillator. The RC oscillator is not very precise and runs with 8 MHz instead of the necessary 8.25 MHz. When the Digispark is attached to the PC, the Digispark software uses the USB clock to align the RC oscillator to 8.25 MHz, and an internal PLL gets its 16.5 MHz clock from this 8.25 MHz signal.

The align process is done only once, and afterwards the RC oscillator may shift as he likes. So after several hours it may have run away too much, and the USB communication gets out of sync.


The serial CDC mode also uses tricks, as it is supposed to use USB full speed (12 MHz clock), but the VUSB libraries and standard AVRs are too slow and use only low speed (1.5 MHz), and it is a matter of luck if the existing Operating Systems support it and will support it in the future.


I have a PC that does not support the ATtiny85, when the board is present at a cold start of the PC. It works only, when the PC running and the board is connected to the USB. Using Linux, it depends on the Kernel if CDC is working at all or loosing sync after a while.

The virtual keyboard, mouse and joystick are working much better, as its no violation of standards to run them with USB low speed.


Perhaps you should better use an AVR board with a Hardware USB chip. The easiest replacement would be an Arduino Micro or Genuino Micro - their USB performance is much more reliable.

Ralf

TeamCirle

  • Newbie
  • *
  • Posts: 2
Re: DigiCDC Randomly will Disappear from USB ls (Ubuntu 14.04)
« Reply #2 on: December 14, 2015, 07:06:21 am »
Thank you for the response Ralf.  This does shed some light on why over time we have seen Random disconnects.  I need to look for a very small form device, such as the digispark, that has USB hardware... or design one. 

Do you have any quick suggestions for a "plug-and-play" option with the USB connection/pins that is similar in size to the digispark?

Thank you again.  Cheers!


Ralf

  • Guest
Re: DigiCDC Randomly will Disappear from USB ls (Ubuntu 14.04)
« Reply #3 on: December 14, 2015, 08:43:13 am »
No,

I never saw a tiny board with an ATmega32U4 and a usb plug for direct connection. The smallest boards I know have a usb socket for USB micro plugs - like the Arduino Micro or some Teensy boards from www.prjc.com.

 If you must stick to the Digispark because of it's form factor, perhaps you may use the DigiUSB library on the Digispark and a commandline tool on the PC side.

It was the predecessor of Digispark's CDC library, but it is obsolete and the sources for the commandline tools are not included in the Digistump software any more.

Have al look if it may fit your needs; I found it's much more reliable than DigiCDC:

http://digistump.com/wiki/digispark/tutorials/digiusb

Source code:
https://github.com/digistump/DigisparkExamplePrograms   --> C++ folder

Ralf