Leonardo doesn't talk to serial monitor in windows 7

The folllowing code talks to the serial monitor when I use an XP machine, but not when I run windows 7. I am using a leonardo rev 3

//Leonardo test 1 -- check serial i/o

void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  digitalWrite(13,HIGH);
  while(!Serial){}
  digitalWrite(13,LOW);
}

void loop(){
  int i;
  Serial.println("Ready:");
  for(i=1;i<11;i++) {
    digitalWrite(13,HIGH);
    delay(500);
    Serial.println(i);
    digitalWrite(13,LOW);
    delay(200);
  }
}

Any suggestions?

did you load the USB <> serial port driver on the windows 7 machine?

Believe it or not: I observe exactly the opposite: your sketch runs fine on my windows 7 sp1 but it does not work on win xp pro sp 2!

I am also investigating problems related to the leonardo's virtual comm port in combination with windows (on linux, the leonardo works great). See here http://arduino.cc/forum/index.php/topic,118090.15.html. This is really driving me crazy.

@wmassano: on your win 7 it does not talk to the serial monitor, but does it blink?

Here are my replies to the three responders:
1.The serial port via usb works since I can program the leonardo. I just can't make it see the serial port when I use the monitor.
2. It's been driving me nuts for a couple of weeks. I hit it when I was building the 4 wheel robot I got from Makershed. I though it was a bad board and replaed it with an Uno which works fine. It's just leonardos (I have tried more than one). I'm going to try it on another win7 machine and see if it is my netbook that's the problem.
3. I'm not sure what you mean by blink. When the monitor starts, the yellow led blinks as it reestablished the comm port, then the RX light blinks once or twice, then nothing. It is hanging at the while(!Serial). It never gets confirmation that Serial is true. (when I take that out the sketch runs but still no serial monitor).

Any other ideas????

I have also had a bad response from the Leonardo but only when using an external programmer.

See my post Arduino V 1.0 and later

Uploading with the bootloader gives a good O/P and no issues, but a programmer seems a bad idea with the Leonardo.

My Freetronics Elevens, ether2560's,even a 2560 mega breakout ex Sparkfun are all fine, all but the Leonardos (I have 3 - they all misbehave when programmed with a programmer).

The Leonardo behaves the same way with XP and Win7 when using a programmer, so it surely can't be that all the OS's and drivers are corrupt, but moreso an issue in the Leonardo architecture.

I'm harping on progammers but I need ISP uploads not usb.

But we try different MCU's, then find one that works for what we want it to do. It's the same with PC's, you buy one that can do the job and not all PC's will work the same, as we all know.

So we need to work out which MCU will do a particular job - so you might end up with a few different types.

PeterVH:
Believe it or not: I observe exactly the opposite: your sketch runs fine on my windows 7 sp1 but it does not work on win xp pro sp 2!

Yes, that I do believe.

Microsoft added support for the special interface association descriptor Leonard uses, in XP SP3 and Vista SP1. The Leonardo bootloader does not use IAD, so XP SP2 can probably recognize Leonardo and upload code, but only when it's running the bootloader.

Windows XP SP2 (and Vista before SP1) can not recognize a USB composite device with Serial (CDC-ACM protocol) and Keyboard (or any other HID). Neither can Mac Leopard or Snow Leopard.

Actually, there are ugly hacks that allow these combinations to work on either system. In the early days of developing Teensy (before Apple released Snow Leopard, not to mention Lion, and XP SP3 was still pretty new) I put a lot of work into trying to find any combination that would work on both. I never found it, and all ways that worked on either violated the USB standards. Teensyduino implements an emulated serial channel when using Keyboard. Shortly after Apple released Lion, I added an option for Keyboard plus real Serial, which of course doesn't work on the older systems.

Leonardo was announced several months after Mac Lion was released, and XP SP3 was of course very well established. It's never really needed to support these older operating systems.

That is great information, Paul. In my opinion, it should be added to the documentation (the minimum SP for windows, the minimum os version for mac). A classic arduino probably works on almost every windows version, for the leonardo, this appears not to be the case.

So the right thing to do for me would be to get SP3. But I should have done that a couple of years ago, now it may not be worth the effort and the risk that this old pc does not survive the upgrade. On the other hand that pc still works well and hapilly deals with my duemilanove, pic18F4550 (also cdc/acm) and the leo's bootloader.

So I thought my Leonardo sketches should work as well if I ran them as "serial only" usb devices (non composite, so no iad needed).

The code allows to do this with only a few ifdefs:

[i]in USBDesc.h:[/i]
#define CDC_ENABLED
[b]//#define HID_ENABLED[/b]
...
[b]#if defined HID_ENABLED && defined CDC_ENABLED
#define COMPOSITE_DEVICE
#endif[/b]

[i]in USBCore.h:[/i]

[b]#ifdef COMPOSITE_DEVICE[/b]
        IADDescriptor                           iad;    // Only needed on compound device
[b]#endif[/b]

[i]in CDC.cpp:[/i]

const CDCDescriptor _cdcInterface =
{
[b]#ifdef COMPOSITE_DEVICE[/b]
        D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1),
[b]#endif[/b]
...

I compiled the sketch again and made a .inf file by copying the UNO's in file and adjusting the PID. This made the sketch run on the old xp sp2 box. I also managed to burn hex files via ArduinoISP into an attiny on the same pc.

I hope this does not sound like cursing to the developers who have put lots of effort to make composite devices work. But I believe this idea makes sense:

  • it is simpler.
  • because of this, it does work on all these old os'es without ugly hacks or spec violations.
  • in many occasions you only need either one of the interfaces, not both.
  • you win about 1K code size (dropping hid support).

Thanks a lot for sharing this. I started to investigate the problem but could not make sense of it. Windows installed the driver without error but the resulting behavior was really weird.

I just downloaded 1.0.3 and the leonardo talks to the serial monitor!!! Now I can get back to work. Thanks to all who made suggestions

I see this is a pretty old post but figured I start here as I have the same problem with xp.

Was hoping somebody had a definitive solution other than trying a different PC or operating system. I tried the 1.0.3 with similar results but I have to believe it has something to do with the set up of the USB device by windows.

Thanks in advance for an help!

Upload the latest update 1.0.5. It fixed my problems

I started with the 1.0.5 with no success

Update-7/8/2013

So I have tried to update my system as well but looks like its all set and even tried the 1.5.2

After some more searching I came across this bit and I am not smart enough to work it out.

Looks like it was done 4 months ago and ffissore says he will add it into the next 1.5.X does this mean 1.5.3 or is it in the 1.5.2?

Any other suggestions? Would really like to get this running on my machine as I am not really in a position to go buy another PC. Although maybe going to an UNO would just be better at this point.