Show Posts
Pages: 1 ... 3 4 [5] 6 7 8
61  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 :-(.
62  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.
63  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.
64  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.)
65  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?
66  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.

67  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.

68  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?
69  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?

70  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.
71  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 13, 2012, 04:40:03 pm
I am affraid this is an os dependent thing. I am using kubuntu. I just tried in win xp, it does't work for me either. I don't understand why, I see no difference between the leo setting a DTR_PIN in function of the line status, and the ftdi chip doing so for its own dtr pin. I must think about this...

What os are you on?
72  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 12, 2012, 04:48:57 pm
Quote
avrdude kept reporting the device signature to be 1E--0B when it says it expects the signature to be 1E--06
Ok, so you have an atmega168p instead of an atmega168. To avoid mistakes, it is better to invoke avrdude with -pm168p instead of using -F.
Not all avrdude installations have an entry for atmega168p in their avrdude.conf; if not, use the avrdude from the arduino IDE.
73  Using Arduino / Microcontrollers / Re: How to program ATtiny45 with Arduino Leonardo as ISP on: November 12, 2012, 04:09:52 pm
To be able to test ArduinoISP/Leonardo/Arduino1.0.2/arduino-tiny, I made a small board with an attiny85, and hooked it up to my Leonardo.

Never used arduino-tiny before, I followed Coding Badly's instructions http://arduino.cc/forum/index.php/topic,132007.0.html and it all worked out of the box. Many thanks to the creators, nice job!
74  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 12, 2012, 02:53:09 pm
@kopfkopfkopfaffe: the plot of RESET makes me think you did not put the series cap of 100nF. (see the ascii art schematics in my post).
75  Using Arduino / Microcontrollers / Re: arduino leonardo as avrisp on: November 09, 2012, 05:07:59 pm
Well, I just tried it. It worked, but there is one small thing: open the serial monitor right after flashing ArduinoISP into the leo (step 5 in my writeup). This is only needed right after uploading the ArduinoISP sketch. This should have been fixed, I'll need to debug this...
 
Pages: 1 ... 3 4 [5] 6 7 8