Show Posts
Pages: 1 ... 3 4 [5] 6 7 8
61  Using Arduino / Installation & Troubleshooting / Re: Leonardo doesn't talk to serial monitor in windows 7 on: December 14, 2012, 06:12:08 pm
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:
in USBDesc.h:
#define CDC_ENABLED
//#define HID_ENABLED
...
#if defined HID_ENABLED && defined CDC_ENABLED
#define COMPOSITE_DEVICE
#endif


in USBCore.h:

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

in CDC.cpp:

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

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.



62  Using Arduino / Installation & Troubleshooting / Re: Leonardo doesn't talk to serial monitor in windows 7 on: December 12, 2012, 06:49:00 pm
@wmassano: on your win 7 it does not talk to the serial monitor, but does it blink?
63  Using Arduino / Installation & Troubleshooting / Re: Leonardo doesn't talk to serial monitor in windows 7 on: December 12, 2012, 05:37:35 pm
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.
64  Using Arduino / Microcontrollers / Re: Leonardo as ISP for ATtiny85 on: December 11, 2012, 04:57:57 pm
@kduin: what windows are you on? I hope it is not xp, I just discovered some problems with it.

The output you posted shows that the ide uses -cstk500v1. It should use -carduino instead (a work around, needed on windows). See http://arduino.cc/forum/index.php/topic,108270.msg1014458.html#msg1014458 for how to do this.
65  Using Arduino / Microcontrollers / Re: How to program ATtiny45 with Arduino Leonardo as ISP on: December 11, 2012, 04:31:20 pm
Well, since johntech2011 is on windows xp, I tried things out on that os (I used win xp pro sp2). Guess what, it did not work. The work around so use -c arduino (http://arduino.cc/forum/index.php/topic,108270.msg1013258.html#msg1) does not help either.

More in general communication over the leo's virtual com port does not work at all: error writing to serial port (tried putty, ide's serial monitor and avrdude) This is strange  since uploadng sketches to the leo's bootloader does work correctly. So this must be caused by the leo's core which works very well with linux but really has some problems with windows.

I want to figure this out but it does not look very good. All ideas are welcome.

66  Using Arduino / Microcontrollers / Re: Burning a Atmega 328 Bootloader with an Arduino Leonardo on: November 29, 2012, 05:50:28 pm
Thanks a lot RoystonS!

Now we know that -c arduino works and -c stk500v1 it is easy to figure out what goes wrong. The answer is in CDC.cpp:
size_t Serial_::write(uint8_t c)
{
        /* only try to send bytes if the high-level CDC connection itself
         is open (not just the pipe) - the OS should set lineState when the port
         is opened and clear lineState when the port is closed.
         bytes sent before the user opens the connection or after
         the connection is closed are lost - just like with a UART. */

        // TODO - ZE - check behavior on different OSes and test what happens if an
        // open connection isn't broken cleanly (cable is yanked out, host dies
        // or locks up, or host virtual serial port hangs)
        if (_usbLineInfo.lineState > 0) {
                int r = USB_Send(CDC_TX,&c,1);

                ...

(The TODO says it all...)
The two lsb bits of lineState correspond to DTR and RTS. Apparently on windows, DTR and RTS are not set, and the Leonardo will refuse to send out anything under these conditions.

I checked in avrdude, the code on linux and mac is the same, it does not do anything special to set RTS/DTR, so apparently the os does that. The windows code uses the win32 api, does nothing special either, but windows does not seem to set the signals.

Why does -c arduino work? Because for this protocol, avrdude explictly drops the signals for 250 ms to discharge the autoreset capacitor! Then it explicitly sets them back high! As a consequence this works also on windows with the Leonardo.

I don't know if we miss functionality when using arduino instead of stk500v1: to check...

I updated my writeup with this info. I am afraid Fulg is not the only one at all. Lots of people must have tried this and have been disappointed it did not work :-(.
67  Using Arduino / Microcontrollers / Re: Burning a Atmega 328 Bootloader with an Arduino Leonardo on: November 27, 2012, 05:20:34 pm
I can repeat the problem over here on a windows pc.
Sigh.
Will look at it tomorrow or so.
68  Using Arduino / Microcontrollers / Re: Burning a Atmega 328 Bootloader with an Arduino Leonardo on: November 27, 2012, 05:12:17 pm
Ok, but this is a leonardo, it should not autoreset. The only reason for autoreset I can see here is if the baudrate is set to 1200 in device manager > comm ports.
69  Using Arduino / Microcontrollers / Re: Burning a Atmega 328 Bootloader with an Arduino Leonardo on: November 27, 2012, 04:49:07 pm
It looks like a serial communication problem indeed.
avrdude sends 0x30, 0x20  ("0 "). If ArduinoISP receves this correctly, it answers with 0x14, 0x10
otherwise it sends 0x15. At this point there is no spi communication with the target yet. ArduinoISP should reply even with the target disconnected. This is what I get with the target disconnected:

Code:
Binaire sketch-grootte: 756 bytes (van een 8.192-byte maximum)
/opt/arduino-1.0.2/hardware/tools/avrdude -C/opt/arduino-1.0.2/hardware/tools/avrdude.conf -v -v -v -v -pattiny85 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/tmp/build5158917964470092706.tmp/Blink.cpp.hex:i

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

         System wide configuration file is "/opt/arduino-1.0.2/hardware/tools/avrdude.conf"
         User configuration file is "/home/peter/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]       <------------- a reply must be received
avrdude: Recv: . [10]
         AVR Part                      : ATtiny85
 ... lines omitted ...
         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
 ... lines omitted ...
 

You don't see the tx led when uploading but you do see the rx led. This make me think the data from avrdude makes it into the core, but not into ArduinoISP, so it does not send out a reply.

You do see the tx led when you enter "stuff" manually. That is weird, but it could be because this happens slower.

-Could you try with an (unmodified) 1.0.1 ide and compare? It will not work because you will have serial buffer overruns, but I would like to see whether it gets further.

-Comment out the delay(40) in the heartbeat() function, it slows things down.

-Another idea: does your serial line work with another sketch. I usually test with the asciiTable sample which I modify such that it continously outputs the table with a second of sleep in between.

-Also inspect port settings in device manager, put it to 8N1 no flow control.

-Do you have an ftdi cable or similar available? (if yes we could do printf debugging over the second port (Serial1) or even use that to upload hex files.)
70  Using Arduino / Microcontrollers / Re: Burning a Atmega 328 Bootloader with an Arduino Leonardo on: November 24, 2012, 11:22:49 am
It looks indeed you checked almost everything.

- Is the tiny new (if not, its fuses could be programmed to disable reset...)?
- Did you try, without the led (should not matter, but you never know)?
- In the preferences dialog, can you select verbose mode for uploading and post the output here?
71  Using Arduino / Installation & Troubleshooting / Re: Programming Pro Mini with Leonardo? on: November 23, 2012, 06:18:46 pm
http://petervanhoyweghen.wordpress.com/2012/11/08/using-the-leonardo-as-usb-to-serial-converter/
I have tried it out on linux 3.0.0 and windows 7 -SP2 64bit.

72  Using Arduino / Installation & Troubleshooting / Re: Windows 7 fails to install driver for Leonardo, unless HID is disabled on: November 21, 2012, 04:00:44 pm
I verified it matched what was in the .inf file: 2341/8036.
To be sure I tried it again: uninstalled the windows driver; on linux reflashed the bootloader; connected to windows again.
I can't reproduce it anymore. This is crazy, I struggled a few evenings with this and now it is gone, I have no idea what manipulation solved it.

Sorry for the trouble and thanks anyway.

73  Using Arduino / Installation & Troubleshooting / Windows 7 fails to install driver for Leonardo, unless HID is disabled on: November 20, 2012, 03:45:11 pm
My leonardo works perfectly under ubuntu/linux 3.0.0-12. I wanted to test whether some stuff I built works with a windows pc. So I hooked up the leonardo to a pc running Windows 7 Home Premium SP1, 64bit. I had a lot of trouble (=understatement) installing a driver for the leonardo. It could install a driver for the booter mode, but not for the sketch mode.

If I watch device manager and plug in the leo, I see that a comm port is added. But as soon as the sketch starts running, the arduino is listed as an unknown device. I tried the "Update Driver" procedure as described in the "leonardo getting started guide": I pointed windows to the arduino-1.0.2/drivers directory. This operation fails: windows reports that a driver could not be found. (Btw, I also have the "RunOnce" registry key).

To rule out my sketch (or my core hacks) as a cause of trouble, I used the ide (on linux) to burn a bootloader to the leonardo. This also burns a fresh standard blink sketch.

Same result, windows cannot install the driver.

I decided to try without the HID (mouse,keyboard) stuff: in  USBDesc.h I commented out this line:
Code:
//#define HID_ENABLED
, recompiled the sketch and uploaded it to the leonardo again using my linux box.
I verified in linux that now the sketch enumerates correctly as a device with only cdc/acm, no HID.

After that,  windows installs the driver correctly, and serial port support works correctly too.

Can someone shed some light on this?
Did someone else observe this problem?
The .inf file for leonardo adds no driver for HID, isn't that a problem?
74  Using Arduino / Installation & Troubleshooting / Re: SerialException with Arduino v1.0.2 and Leonardo on: November 17, 2012, 04:48:28 pm
I am affraid it is caused by a fix I submitted for the problem described here: http://code.google.com/p/arduino/issues/detail?id=995&can=1&q=leonardo.

Sorry for that.

When starting an upload the ide sets the baurate to 1200. When the leonardo observes a DTR drop when the baudrate is 1200, it resets.
In order to avoid unintentional autoresets, the fix sets above sets the baudrate back to the value from the preferences, once the upload completed. For some reason this sometimes fails on your system (different locking scheme on the mac: lock still held by avrdude? the reason should be investigated...). On my system (kubuntu/linux 3.0.0-12) it always works correctly. I'll help think about a proper solution (don't have a mac though) :
  • Maybe just catch the exception and ignore it (after all, it can also happen the sketches serial port never comes back, this is of coarse ignored too...)
  • Retry touching a number of times?
  • ...
Fortunately, when the problem occurs, the sketch is already uploaded and works correctly, like you indicated.

Could you submit a bug report?

75  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 13, 2012, 05:23:07 pm
We'll get there, I found back a pic18f4550 with which I built the same thing. It works on windows too, I just need to find out what it does differently.
Pages: 1 ... 3 4 [5] 6 7 8