Pages: 1 [2] 3   Go Down
Author Topic: Leonardo on OSX - not in sync when uploading  (Read 13707 times)
0 Members and 1 Guest are viewing this topic.
Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Solved one of the problems: when the program is running, it was installed as COM11, and when the bootloader is running, it's running as COM10. So the switching messed it up... plus, when I got my Leo (above), 1.0.1 wasn't out and the docs didn't show the Leonardo yet, so I didn't know to let the uploader perform the reset (I thought manually resetting it would help). Good to know.

Seems to be running smoother now that I set both ports to COM10 to overlap each other (since they never install at the same time). Now it's running my old Arduino programs almost trouble-free, though I have a few conversions to make for the 1.0 release (it's been a while!). smiley
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I initially used "Keyboard.print('n')" and "Keyboard.print(KEY_F4)", but only the "n" and "r" would work, but KEY_F4 wouldn't trigger. Switching it to "Keyboard.write()" worked for the whole thing, which was a bit strange... a little rusty (haven't done Arduino in over a year), but shouldn't they be the same function?

No. Why have two things that do the same? The print function has various overloads, to handle int, char, float, long etc. The write function doesn't.
Logged

Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, that's right... like I said, a bit rusty. Though it makes sense to me that write would simply be an alias of print, since print apparently does the same function but has additional overload flexibility to handle different data types.

... Buuuuut, that said, and I know we're a bit off-topic here, but a quick diversion: why would KEY_F4 work with write() and not print()? :/
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Show me how it's defined and I will be able to answer that.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

BTW, we expect the application (sketch) COM port to be different than the bootloader COM port.  The upload process takes that into account (it waits for the sketch COM port to disappear and for any new COM to appear, assuming it's the bootloader).  If you have better luck by forcing them to be the same, that sounds good to me.  Just wanted to let you know that it's not necessarily a problem that they have different numbers.

And yes, my guess is that KEY_F4 is an int, and so print() tries to print its digits rather than sending it as a single key press.  The write() function always tries to send a single key press (or a single byte, if you're using Serial).
Logged

Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I actually posted it at the end of the last page smiley

Code:
void setup() {
  Keyboard.begin();
}

void loop() {
  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.write('r');
  Keyboard.release(KEY_LEFT_GUI);
  delay(500);
  Keyboard.println("notepad");
  delay(500);
  Keyboard.println("I am a banana!");
  delay(random(1000,3000));
  Keyboard.press(KEY_LEFT_ALT);
  Keyboard.write(KEY_F4);
  Keyboard.release(KEY_LEFT_ALT);
  Keyboard.write('n');
  delay(random(1000,10000));
}

"Keyboard.write()" was just "Keyboard.print" before. I think mellis nailed it: since definitions are "translated" into their raw definition name (that is, "#define KEY_F4 123" will turn the characters "KEY_F4" into the characters "123" in the code, not necessarily "the value which is 123")... still strange that it would try to punch the characters "123" as a string via the definition without being quoted in the definition. If that makes any sense. *checks include files*...

edit: Hmm... nothing unusual there. Quoth USBAPI.h:
Code:
#define KEY_F4 0xC5
... which is about as well-defined as it gets.

Oh, I know what it was doing. It was taking it as an integer value *to be keyed out* as a character string. Derp. I think I ran into that problem long ago, but hey... like I said, a bit rusty. Mystery solved.  smiley-kiss
« Last Edit: May 23, 2012, 10:11:01 am by FalconFour » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

still strange that it would try to punch the characters "123" as a string via the definition without being quoted in the definition. If that makes any sense.

Not really. If you wrote this:

Code:
Serial.print (123);

Wouldn't you expect to see "123" printed? Not some character equivalent.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my first post! Bought the Leonardo at the Maker's Faire. Saw forum problems with 1.0 IDE after I had a series of failures on two different Windows machine; I will not try 1.01.

    Thanks - Rick
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With IDE 1.01 I was able to connect to the USB port and load "Blink." I'm new to Arduino, so I'm not sure if this is the right program for testing...

Here is the error message I received:



Binary sketch size: 4,858 bytes (of a 28,672 byte maximum)
Found programmer: Id = "SpŸ"; type = p
    Software Version = V.O; Hardware Version =v.0
avrdude: error: buffered memory access not supported. Maybe it
isn't a butterfly/AVR109 but a AVR910 device?


I am running Windows XP home, Service Pack 3, USB 1.0

Any suggestions on what to do next?

            Thanks - Rick
By the way, the Leonardo R3 board says it is made in Italy.
Logged

Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, there seem to be a _lot_ of glitches in the upload process with the current firmware (bootloader)/IDE. I've had it literally crash my computer twice by rapidly inserting/holding/removing devices during the reboot cycles. I've learned one important lesson: don't hold "Reset" - ever. Common to halt a runaway program until I can reprogram it (without device-cycling the USB connection with a plug/unplug), but it's a reliable way to totally hang the USB bus on the Leo.

I found that the most reliable way to upload is to make sure the program IS RUNNING when it goes to upload. It has no fall-backs or intelligent detection, it seems, for checking if the board is already waiting at the bootloader, so when the LED is "pulsing" and it tries to upload, it just goes "herrr, dohh... timeout", starts running the program while avrdude is still trying to contact the board (or Arduino is trying to find the port), and it wonders why it can't find the board.

Beta blues, I guess. No hard feelings. I'm having tons of luls with the best $20 I'd ever spent smiley

Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

open_market: the Leonardo isn't supported under 1.0; you don't have to try 1.0.1 if you don't want, but that's the only version that supports the board.

FalconFour: thanks for all the information.  It's a good point about not starting an upload when the bootloader is already running; I'll add that to the getting started page for the Leonardo.  On the other hand, holding down the reset button should be okay (at least, it's always worked for me).  If I'm having problems uploading normally, I'll hold down the reset button, wait for the IDE to say "Uploading..." and then release the button.  Can you provide some more details about the problems you're having with holding the button down (e.g. when are you doing it, what exactly happens, which operating system you're using, etc)?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand 1.0 is not supported. Once I tried 1.01, the usb driver started working. The error I reported when trying to upload the Blink application was using 1.01.

I just tried it again holding down the reset button until compile was complete and upload started - I got the same identical error message:

Found programmer: Id = "SpY"; type = p
   Software Version = V.O; Hardware Version = v.)
avrdude: error: buffered memory access not supported. Maybe it
isn't
a butterfly/AVR100 but a AVR910 device?

Where do I go from here?

   Thanks - Rick

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 28
blink. blink. blink. blink. blink.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

open_market: Thanks for writing.  It looks like you might have the wrong serial port selected in the Arduino IDE.  Your "Found programmer: Id = "SpY"; type = p Software Version = V.O; Hardware Version = v.)" message indicates that the upload software is getting a response from some device on the port, just not a Leonardo (or any other Arduino). 

Can you double-check the port that you have selected under "Serial Port" in the menu?  To find the correct port, start by disconnecting the Leonardo and looking at the list of available ports.  Then connect the Leonardo, wait for the LED to stop "breathing", and see what new port you have available - that will be your Leonardo.

If that doesn't work for you, can you please enable verbose output during upload in the IDE preferences and paste the eror message you receive?
Logged

Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

FalconFour: thanks for all the information.  It's a good point about not starting an upload when the bootloader is already running; I'll add that to the getting started page for the Leonardo.  On the other hand, holding down the reset button should be okay (at least, it's always worked for me).  If I'm having problems uploading normally, I'll hold down the reset button, wait for the IDE to say "Uploading..." and then release the button.  Can you provide some more details about the problems you're having with holding the button down (e.g. when are you doing it, what exactly happens, which operating system you're using, etc)?
Basically what happens is that it hangs the whole PnP interface of the PC, to where no devices can no longer be detected added or removed (USB, ExpressCard, etc), and devices can't be disabled/enabled anymore either - doing so just hangs the process making the attempt. In fact the computer won't even shut down anymore, it just hangs at "Logging off" or "Shutting down" (depending on how long I wait - over 10 minutes at "Shutting down"). I can plug/unplug anything, and Windows no longer detects anything is being plugged/unplugged. Of course, when I reboot (holding the power button, ugh!), everything goes back to normal again.

It's Windows 7 32-bit on a Dell XPS m1710 (Intel-based chipset). I do have VMware Workstation installed which uses a "USB Arbitration service" to manage virtual USB connections, so I'm not sure if that's to blame.

Usually it happens after I've failed to upload a few times, sitting at the bootloader attempting to upload. Maybe I hit and held Reset while it was attaching the device, and it hung during the "initialization" which crashed the USB driver. Not sure, but it always seems to revolve around having held "Reset" down.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Zeveland,

My Leonardo is on COM4 - which I set in the IDE 1.0.1, with verbose mode here is the result:

Binary sketch size: 4,858 bytes (of a 28,672 byte maximum)
Forcing reset using 1200bps open/close on port COM4
PORTS {COM1, COM3, COM4, } / {COM1, COM3, COM4, } => {}
PORTS {COM1, COM3, COM4, } / {COM1, COM3, COM4, } => {}
PORTS {COM1, COM3, COM4, } / {COM1, COM3, COM4, } => {}
PORTS {COM1, COM3, COM4, } / {COM1, COM3, COM4, } => {}
PORTS {COM1, COM3, COM4, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, COM4, } => {COM4, }
Found Leonardo upload port: COM4
C:\Downloads\arduino\arduino-1.0.1\arduino-1.0.1-windows\arduino-1.0.1\hardware/tools/avr/bin/avrdude -CC:\Downloads\arduino\arduino-1.0.1\arduino-1.0.1-windows\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega32u4 -cavr109 -P\\.\COM4 -b57600 -D -Uflash:w:C:\DOCUME~1\Rick\LOCALS~1\Temp\build6743039881646635356.tmp\Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Downloads\arduino\arduino-1.0.1\arduino-1.0.1-windows\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM4
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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    10     8    0 no       1024    8      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .avrdude: Send: . [1b]
avrdude: Send: S [53]
avrdude: Recv:

avrdude: Recv:
avrdude: Send: V [56]
avrdude: Recv:
avrdude: Send: v [76]
avrdude: Recv:
avrdude: Recv:
avrdude: Send: p [70]
avrdude: Recv:
Found programmer: Id = "¨ÿ""; type = m
    Software Version = E.


               Tanks - Rick


Logged

Pages: 1 [2] 3   Go Up
Jump to: