Show Posts
Pages: 1 ... 3 4 [5] 6 7 8
61  Using Arduino / Microcontrollers / Re: Weird issue: Micro won't transmit win8 on: December 29, 2012, 06:28:23 pm
Quote
...but if I run the ASCIItable sketch I do not see anything in the serial monitor.
I can repeat the behavior on a leonardo with windows 7 SP1, with linux it works correctly.

I know what happens. After you download the sketch, the IDE touches the serial port to remove the magic baudrate. Touching means it briefly opens the sketch's serial port. As a result, the "while (!Serial);" loop exits and the sketch wants to start sending characters. But the port is closed again briefly after this and your characters get lost.

As a work around you can reset the board with the reset button, after this the while (!Serial); loop has the desired effect and chars end up in the serial monitor.

Another work around (though kludgy) is this:

Code:
while (!Serial);  // <-- detects the touch
delay(200);
while (!Serial);  // <-- waits for the real port opening

Btw. It was me who proposed to touch the port after uploading, maybe it should be rolled back.

62  Using Arduino / Installation & Troubleshooting / Re: Leonardo won't initiate serial communication on: December 28, 2012, 05:54:30 pm
I just tried out serial comms between processing and the leonardo, myself. On the pc I did not need to do anything special to set DTR/RTS, so apparently processing (or the underlying rxtx) does this for you.

I have a better test sketch (for the leo/micro):
Code:
static const int led = 13;
unsigned char x;

void setup() {
  Serial.begin(9600); // Start serial communication at 9600 bps
  pinMode(led, OUTPUT);
  digitalWrite(led, Serial ? HIGH : LOW);
}

void loop() {
  Serial.write(x & 1);
  digitalWrite(led, Serial ? HIGH : LOW); 
  delay(1000); 
  x++;
}
It alternately sends out 0 and 1. Also, via the arduino led, it lets you observe DTR/RTS: Serial (or rather Serial's boolean operator) returns true when either DTR or RTS are high.

Run this sketch on the leo.
As long as the PC does not open the comm port, the leo's (or micro's) arduino led and the tx led remain dark. The leo runs its loop but all written bytes are dropped by the core.

Then, on the PC, fire up the standard processing example Libraries>serial>SimpleRead.
The arduino led lights up and the tx led flashes.
(and SimpleRead alternately shows a gray or black rectangle).

Note the behavior is different if you run the sketch on an Uno or Due (programming port). For these boards the tx led keeps flashing even if SimpleRead does not run (port not opened by the pc). (though I find that the leo's behavior is ok in this situation).

I tried this on linux 3.0.0-12 (kubuntu) and on windows 7 SP1. On windows I had to dowload the 32 bit version of processing because Serial does not run in 64 bit mode.

Could try whether this basic setup works for you?
63  Using Arduino / Installation & Troubleshooting / Re: Leonardo won't initiate serial communication on: December 27, 2012, 03:53:52 pm
Quote
I am looking at the pin diagram right now, I do not see DTR or RTS pins... I see RST on the board, but cannot make it which pin it actually is.

You are using the leonardo's virtual com port, so DTR and RTS are no real pins. The pc can however send control messages to "set" or "clear" these "virtual" DTR and RTS signals. And the leonardo's core will only send out data if DTR or RTS are set by the pc.
Quote
I am trying to get Analog input into Processing.
So you're processing app should set DTR/RTS. I don't know whether the Processing framework does this for you or how you can do this yourself.

Maybe it is best that you first try to run a simple app that sends out some  serial data and see whether you can receive the bytes from the Arduino-1.0.3 serial monitor. Maybe use wmassano's sketch:http://arduino.cc/forum/index.php/topic,137032.0.html
64  Using Arduino / Installation & Troubleshooting / Re: Leonardo won't initiate serial communication on: December 25, 2012, 05:24:44 pm
The leonardo only sends out data if the program/os on the pc sets either DTR or RTS, (or both) high. If you use a program like putty or the serial monitor in the IDE to communicate with the leonardo, there is no problem because these programs set DTR and/or RTS. If you do serial communications from your own program you must make sure yourself to set DTR/RTS.

Quote
I have been trying for 4 days now with no lunck.

Can you tell us more about what you try to accomplish? And on which os, version, sp...?
You may observe the same problem as what is described in this thread but it might be something completely different as well.

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



66  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?
67  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.
68  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.
69  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.

70  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 :-(.
71  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.
72  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.
73  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.)
74  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?
75  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.

Pages: 1 ... 3 4 [5] 6 7 8