V-USB device conflicts with the mouse

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
PNO

V-USB device conflicts with the mouse

Post by PNO » Fri Feb 15, 2013 9:33 pm

Hi!

I work with a V-USB device based on Attiny45. It is nearly a hardware clone of "EasyLogger" or "AVR-CDC" devices - I use Attiny45 without crystal oscillator.
It worked fine until I accidentally connected it into the same USB-hub, where a mouse was connected to. My device refused to work, and I saw an "unknown device" in Device Manager.
If I disconnect a mouse, then connect my device, and after that connect the mouse again, everything is OK, and my device works fine. But if the mouse is already connected, my device can't pass the enumiration. And I see this problem with several computers with different operating systems.
I have another V-USB device - the clone of "AVR-Doper", based on Atmega8 with 12MHz crystal oscillator. It hasn't this problem, and It always works fine!
And when I connected the 12MHz crystal oscillator (as an experiment) to my Attiny45-based device It solved the problem! But I can't use a crystal in my project, because I need all 6 I/O pins of the AVR...
Does anyone know a way of solving this problem?


Thanks.

ulao
Rank 4
Rank 4
Posts: 480
Joined: Mon Aug 25, 2008 8:45 pm

Re: V-USB device conflicts with the mouse

Post by ulao » Fri Feb 15, 2013 9:54 pm

Is it possible your using a stolen device id? Far fetched but see if the PID and VID math the mouse. If that is not it try changing your HID report classification, what device is this you are making a joystick?

PNO

Re: V-USB device conflicts with the mouse

Post by PNO » Sun Feb 17, 2013 10:25 am

Dear ulao!
Thank you, but I do not think you understand my problem:
My device without a crystal oscillator works fine but conflicts with the mouse.
But this device (one and the same device, with one and the same firmware) with a crystal oscillator works fine and doesn't conflict with the mouse.
Why???
By the way, when I load EasyLogger firmware into my device, It work just like with my firmware...

ulao
Rank 4
Rank 4
Posts: 480
Joined: Mon Aug 25, 2008 8:45 pm

Re: V-USB device conflicts with the mouse

Post by ulao » Sun Feb 17, 2013 11:46 pm

PNO , your right I do not understand. I'm afraid that made it even more confusing. That way I'm understanding this make me wonder why an oscillator has anything to do with it.

Few thing here.

1) When making a hub device you need a solid oscillation ( i.e: 12.000 not 12.001 or any other drifted clock ). USB timing is very picky. I would not see how timing would do as you say but rather not work at all. Though without a solid clock any number of things could go wrong I suppose?

2) just to help understand this, what type of device are you making? Is this a usb HID device of some kind?

3) Its possible the inter oscillator will work depending on the chip, I dont know the Attiny45. If it is a solid 12.000, 16.000, or what ever and you project is set up correctly then it shoudl work yes... EasyLogger may just be setting the clock in the make file correctly where you may not ( only a guess ). What is your F_CPU set to vs EasyLogger in the makefile? Also check in you usbconfig for USB_CFG_CLOCK_KHZ. I dont think USB_CFG_CLOCK_KHZ is any longer needed but if its there make it match EasyLogger's.

declan smith
Rank 1
Rank 1
Posts: 32
Joined: Fri Nov 02, 2012 3:26 pm

Re: V-USB device conflicts with the mouse

Post by declan smith » Mon Feb 18, 2013 3:54 am

same USB-hub, where a mouse was connected to


Don't use USB-hub if you implement V-USB, use direct USB port, it mostly make some "unknown device trouble" with it, especially when use "USB wireless" keyboard or mouse in the same hub.
Sometimes it works correctly then unrecognize with no reason even with no unplug. Don't know why. (My device uses crystal)
I tried it on several china made USB-hub, and when it happened, sometimes the hub itself become didn't recognize by the host.
Strange but true.
So, I don't think the issue was your device.

PNO

Re: V-USB device conflicts with the mouse

Post by PNO » Mon Feb 18, 2013 11:23 am

To declan smith:
Thanks, but I don't use an external USB-hub, I'm talking about the internal PC hub, which is on motherboard!

I finally solved the problem:
The whole thing is CLI and SEI.

In osccal.h we can see:
#define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();}

if I remove cli() and sei(), everything works fine!
Very interesting but very strange.
Is it a nearly invisible bug in V-USB driver?
My problem occured only when my device was connected it into the same internal PC USB-hub, where a mouse was connected to...

Post Reply