Author Topic: DigiUSB, issue with Echo example. Keyboard example working  (Read 8623 times)

LTG

  • Newbie
  • *
  • Posts: 1
DigiUSB, issue with Echo example. Keyboard example working
« on: February 03, 2013, 04:06:52 am »
I'm having trouble getting DigiUSB to work. I'm testing on my MacBook Air with OSX 10.6.

I have tried the Digispark Keyboard example, and it works but I can not get the DigiUSB Echo working.
When I test the keyboard example and look in USB Prober, it first pops up as the programmer and a while later re-enumerates to 'Composite device: "DigiKey"'.
When I tries the Echo example it enumerates as the programmer and then it does not re-enumerate itself. Just the programmer disappears from the list and nothing more happens.

Running monitor.py just tells me no DigiUSB device found

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: DigiUSB, issue with Echo example. Keyboard example working
« Reply #1 on: February 04, 2013, 01:57:40 am »
This sounds like the machine doesn't like the timing of things with DigiUSB


Can you try changing the


delay(10);


line to


_delay_ms(30);


Let me know if that helps.


Thanks,
Erik

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: DigiUSB, issue with Echo example. Keyboard example working
« Reply #2 on: February 07, 2013, 08:40:08 am »
Can you try changing the

delay(10);

line to

_delay_ms(30);

I'm not the original poster, but I'm having the same problem. The keyboard example works, but when I load the Echo example, USBProbe doesn't show any communications at all.

However, I do see the device on the USB bus, and I can probe info from it using a nodejs program. Here's the nodejs code:

var HID = require('node-hid');

var device,ds;
var devices = new HID.devices(0x16c0, 0x05df); // look for digisparks

if (devices.length > 0) {
    console.log(devices);
    console.log('Attaching to first entry.');
    device = devices[0];
    console.log('USB Path ', device.path);

    ds = new HID.HID(device.path);

    ds.write([65, 65, 65, 13, 10]);

    ds.read(onRead);

} else {
    console.log('No Digispark found.');
}

function onRead(err, data) {
    if(err) {
        console.log('Err! :-(');
    } else {
        if (data[0] != 0) {
            console.log('DATA: ' + data);
        }

        ds.read(onRead);
    }
}
 
When I run this, I get the following output:

[ { vendorId: 5824,
    productId: 1503,
    path: 'USB_16c0_05df_fd130000',
    serialNumber: '',
    manufacturer: 'digistump.com',
    product: 'DigiUSB',
    release: 256,
    interface: -1 } ]
Attaching to first entry.
USB Path  USB_16c0_05df_fd130000

So it *is* seeing my Digispark. But the DigiUSB lib doesn't seem to be communicating for some reason.

Any ideas?

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: DigiUSB, issue with Echo example. Keyboard example working
« Reply #3 on: February 07, 2013, 12:50:50 pm »
Okay, it appears that my difficulties are somewhere in my node-hid usage. I was able to run the python DigiUSB scripts successfully. I'll see if I can narrow down what's wrong with my attempts to interface from nodejs.


Cyberwizzard

  • Newbie
  • *
  • Posts: 5
Re: DigiUSB, issue with Echo example. Keyboard example working
« Reply #4 on: May 17, 2013, 11:44:24 am »
I have the same issue as the OP: Digispark enumerates fine with keyboard example and for programming (albeit after flashing to firmware version 1.06) but not with the DigiUSB example. Dmesg:
Code: [Select]
[ 2240.100140] usb 5-2: new low-speed USB device number 39 using uhci_hcd
[ 2240.280163] usb 5-2: device descriptor read/64, error -71
[ 2240.616047] usb 5-2: new low-speed USB device number 40 using uhci_hcd
[ 2240.736144] usb 5-2: device descriptor read/64, error -71
[ 2241.016158] usb 5-2: device descriptor read/64, error -71
[ 2241.232069] usb 5-2: new low-speed USB device number 41 using uhci_hcd
[ 2241.644133] usb 5-2: device not accepting address 41, error -71
[ 2241.756059] usb 5-2: new low-speed USB device number 42 using uhci_hcd
[ 2242.164143] usb 5-2: device not accepting address 42, error -71
[ 2242.164168] hub 5-0:1.0: unable to enumerate USB device on port 2

I opened up libraries/DigisparkUSB/DigiUSB.cpp and in 'void DigiUSBDevice::begin()' changed '_delay_ms(1)' to '_delay_ms(10)'.

Reflashed into the Digispark and the DigiUSB example works!

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: DigiUSB, issue with Echo example. Keyboard example working
« Reply #5 on: May 17, 2013, 02:17:31 pm »
Cool - I'll test that change and include it in the next release if it doesn't cause any issues! Thanks!