USB problems with MacOSX?

Hi,

when plugged on my macbook pro, my arduino UNO is powered, but does not show up anymore: no dialog box for a new network device, nothing in /dev/tty* etc. Same behavior with my USBtinyISP: nothing in /dev, in "Usb Prober.app", console.app, dmesg etc.

After a lot of research on various forums, I ended up to this page: http://mightyohm.com/blog/2010/09/improved-firmware-for-usbtinyisp-fixes-usb-issues-in-virtualbox/ . Basically, the USBTinyISP was not working when connected directly to a USB port. But it would work if it were connected through a USB 1.1 device, such as a keyboard or a hub. I tried to connect the devices through a keyboard connected to my mac: both the USBTinyISP and arduino worked as expected.

My guess is that the problem and the solution is the same than the ones exposed in the above page: the USB stack on ISP and on the arduino is buggy. The code is supposed to be based on this one: http://dicks.home.xs4all.nl/avr/usbtiny/. This has evolved to version 1.6, while as far as I understood it, the ISP and arduino is based on an older one (back to 1.3, as usbtinyisp?) (is it this one ? : http://www.wulfden.org/TheShoppe/freeduino/ADABOOT.shtml).

So my question is: what is the firmware that is burnt with the arduino when I use the command on the IDE ? If it's outdated, do you plan to change it in the official firwmare ?

Again, this may explain why it does not work on my mac (and maybe others), but I'm not sure.

I would have like to update the firmware on my USBTinyISP to check if that would make it work, but I have no other ISP to program my ISP, and I'm not sure about how to do that. Plus, the adafruit web site says explicitly that no post about how to burn the firmware is allowed on the forum sigh. Still, there is a thread about a new firmware on the adafruit website: http://forums.adafruit.com/viewtopic.php?f=20&t=22436&start=0, but it has not been updated since.

Cheers,

stéphane

stefski66: So my question is: what is the firmware that is burnt with the arduino when I use the command on the IDE ?

It's whatever hex file is included with your version of the IDE. The files are in the Arduino.app package.

You can also get the latest bootloader files from the github repository: https://github.com/arduino/Arduino/tree/master/hardware/arduino/bootloaders

They go in /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders

stefski66: If it's outdated, do you plan to change it in the official firwmare ?

Who is you? I don't plan to do it.

ok, I’ll look at it, thanks. I have the latest IDE (1.0), so I have the firmware that comes with it.

‘you’ should have been ‘the people who feel in charge of maintaining the firmware’, like the people with the write access on the github?

stefski66: I ended up to this page: http://mightyohm.com/blog/2010/09/improved-firmware-for-usbtinyisp-fixes-usb-issues-in-virtualbox/

What has Virtualbox got to do with it? Are you running that on the Mac?

What version of OS/X do you have?

what is the firmware that is burnt with the arduino when I use the command on the IDE ?

What command?

Are you referring to the firmware on the USB chip or the Atmega328?

[quote author=Nick Gammon link=topic=88195.msg663307#msg663307 date=1327296159]

stefski66: I ended up to this page: http://mightyohm.com/blog/2010/09/improved-firmware-for-usbtinyisp-fixes-usb-issues-in-virtualbox/

What has Virtualbox got to do with it? [/quote]

nothing. But the symptoms are the same than the symptoms mentioned in the link above: I must plug the arduino through a hub or a keyboard to make it detected properly by the MacOSX system. Same behavior with my USBTinyISP.

Quoting the link above:

"The firmware that powers the Adafruit USBTinyISP is based on Dick Streefland’s usbtiny project. Dick has released a couple more revisions of his code since the v1.3 release that Limor Fried used to create the USBTinyISP v2.0 firmware. There have been a few bug fixes and improvements to the code, including some that address USB enumeration/communication issues."

And this is my understanding that the USB stack on the arduino comes from the same sources, but again, I may be wrong...

My reasonning is: since the symptoms are the same, maybe the problem and the solution are the same i.e. update the bootloader with an improved usb stack.

[quote author=Nick Gammon link=topic=88195.msg663307#msg663307 date=1327296159] What version of OS/X do you have? [/quote]

10.6.8, on a MacBook Pro i7.

[quote author=Nick Gammon link=topic=88195.msg663307#msg663307 date=1327296159]

what is the firmware that is burnt with the arduino when I use the command on the IDE ?

What command? [/quote]

Tools > Burn Bootloader

[quote author=Nick Gammon link=topic=88195.msg663307#msg663307 date=1327296159] Are you referring to the firmware on the USB chip or the Atmega328? [/quote]

I do not know which chip handles USB, I was guessing that it was the bootlader, but I'm not sure.

stefski66: I do not know which chip handles USB, I was guessing that it was the bootlader, but I'm not sure.

Answering to myself...

After a discussion with a friend of mine, it seems the USB stack is not handled by the bootloader, but by the 'USB DFU', which code comes from http://www.fourwalledcubicle.com/LUFA.php. I may contact the people over there and see if my guess is true.

cheers,

s.

There are two processor chips on your Uno. The Atmega328 and the Atmega8U2 (or 16U2 depending on the model) which handles the USB. Burning a new bootloader on the Atmega328 isn't going to change the USB behaviour.

If you have a Rev 3 Uno there is an SPI header for updating it. Personally I haven't had to and I use Macs all the time.

And I have a USBtinyISP on my iMac which works perfectly (or almost perfectly, I have to plug it in twice usually for it to be recognised).

[quote author=Nick Gammon link=topic=88195.msg663500#msg663500 date=1327315816] There are two processor chips on your Uno. The Atmega328 and the Atmega8U2 (or 16U2 depending on the model) which handles the USB. Burning a new bootloader on the Atmega328 isn't going to change the USB behaviour.

If you have a Rev 3 Uno there is an SPI header for updating it. [/quote]

Ok thanks for the explanation and the suggestion. I'll check the version of my arduino. I will try to figure out what an SPI header is to update it, but if you have time to point me where to look or to explain it, I would be grateful. :P

[quote author=Nick Gammon link=topic=88195.msg663500#msg663500 date=1327315816] Personally I haven't had to and I use Macs all the time. And I have a USBtinyISP on my iMac which works perfectly (or almost perfectly, I have to plug it in twice usually for it to be recognised). [/quote]

how old are your macs ? On the USBTinyISP web site, it is said: "If you have a newer Mac OS machine, try sending it commands via avrdude - the LED should light up then (strange but true!)". I know this is not the same problem, but it seems that the 'oldness' or 'newness' of the machine plays a role here.

anyway, the fact that everything work as expected only through a proxy USB device suggests a USB problem IMHO.

I bought mine in May 2010. You seem to have USBtinyISP, so I would try plugging that in and typing:

avrdude -c usbtiny -p m328p -v

That just does a verify of the existence (and fuses) on an attached Atmega328 processor. You should at least see something even without plugging the processor board in eg,

...
         Using Port                    : unknown
         Using Programmer              : usbtiny
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
...

If you see instead:

...
         Using Port                    : unknown
         Using Programmer              : usbtiny
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
...

Then it didn't recognize it. And just as happened when I posted that, unplugging and plugging back in fixed it. And with it actually plugged into a Uno (try to get pin 1 right, heh) I see this:

...
avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as 5

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

[quote author=Nick Gammon link=topic=88195.msg664328#msg664328 date=1327353006] I bought mine in May 2010. You seem to have USBtinyISP, so I would try plugging that in and typing:

avrdude -c usbtiny -p m328p -v

That just does a verify of the existence (and fuses) on an attached Atmega328 processor. You should at least see something even without plugging the processor board in eg,

[/quote]

I will do that in a few hours when I'm back at home. But my guess is that I will see something like: avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

I'll edit this message if it's not the case.

Guessing isn't the scientific method. :)

[quote author=Nick Gammon link=topic=88195.msg664895#msg664895 date=1327394280] Guessing isn't the scientific method. :) [/quote]

I would say "Guessing without checking is not the scientific method" :)

I checked. I guessed correctly: USBTinyISP -> MacBook Pro. Green Light off.

psyko:shruthi conversy$ avrdude -c usbtiny -p m328p -v

avrdude: Version 5.10, compiled on Mar 10 2011 at 00:46:40
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/conversy/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : unknown
         Using Programmer              : usbtiny
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done.  Thank you.

Green light still off.

now, using a usb hub: USBTinyISP -> hub -> MacBook Pro. Green light still off.

psyko:shruthi conversy$ avrdude -c usbtiny -p m328p -v

avrdude: Version 5.10, compiled on Mar 10 2011 at 00:46:40
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/conversy/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : unknown
         Using Programmer              : usbtiny
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Green light on.

Interesting. Well using a hub isn't a big deal is it? If possible do a OS update on the Mac. Not that I am very confident about that. The problem might be in the firmware of a chip on the motherboard.

no for sure, this does not prevent me to do things with it. The thing is: I had a hard time to figure out a solution. I guess that other MacOSX users may run into the same kind of problems. And I think this deserves a fix.

again, considering the above links, I think this comes from the firwmares of the arduino and the ISP. I have cross-posted this discussion on the LUFA forum: http://groups.google.com/group/lufa-support. We’ll see.