Leonardo & Serial Issue SOLUTION? and receive buffer limit?

Hi

Just solved aproblem we were having using windows to talk to the Leonardo via serial CDC.

The leonardo seemed unreliable when we were trying to make serial connections (opening the port), and the problem was experieced when trying to connect with X-CTU also. Sometime the port would be visible but would fail to open.

The problem turned out to be our coding. It seems that with the Leonardo you must close down the COM port properly before exiting the windows application, otherwise it hangs and wont open again unless physically disconnected (from USB) for any application. Once we close the serial port on the windows application during shutdown, everything works out OK.

Hope this saves some time for others.

Another, thing we noticed is that the maximum serial buffer size supported via CDC seems to be about 12,330 bytes and if you send more (which we do sometimes) you can lose some data. If we set the receive buffer size to say 20,000 bytes it maxes out at 12330 on the Leonardo.There doesn't seem to be a limit with non CDC Arduinos. If anyone has an easy workaround for this 12,330 limit please comment.

BTW: I presume this is a windows/CDC driver issue and not Arduino per se.

========================================================
For anyone interested in IR protocols - we have just launched a project for AnalysIR - IR Decoder & Analyzer GUI (Arduino & Raspberry Pi). Currently we support 17 IR protocols and are looking for more to add as part of the campaign. Suggestions Welcome!
You can find out more and support the Project by visiting AnalysIR - IR Analyzer & Decoder with Arduino, Raspberry Pi, and MCU | Indiegogo or Screenshot via www.AnalysIR.com
You can also see our project on the Aduino Blog

You nede to enable DTR when using Leonardo

Good tip tnx!

Fortunately, we had this done also. I have also noticed on other Arduinos (can’t remember which models) that if we didn’t have DTR/RTS enabled that we would get some odd behaviour on the serial USB sometimes (particularly at higher baud rates). So we always do it now for Windows applications talking serial over usb to Arduino.

We have solved our problems with Leonardo, based on original post - just sharing our experience.

If anyone has a workaround for this Windows serial receive buffer limit of 12330 for CDC serial, please share.