Search the web
Sign In
New User? Sign Up
lpc21isp
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Bug in ClearSerialPortBuffers() - uses uninitialized termios structu   Message List  
Reply | Forward Message #189 of 429 |
I was testing the lpc21isp program on Linux using a USB-to-serial
converter as the interface to my development board and I think I
found a bug in the ClearSerialPortBuffers() function. The "tty"
termios structure is not initialized before it is written to the
serial port to flush the input and output buffers. For some reason,
this causes glitches on the DTR and RTS outputs of the USB-to-serial
adapter and then prevents synchronization with the microcontroller.

Is there any reason that the current termios configuration
("origtty") read from the port couldn't be written back with the
TCSAFLUSH action?

I am using version 1.49 of lpc21isp.

Thanks,
Gregg.

/*****************************
ClearSerialPortBuffers********************/
/** Empty the serial port buffers. Cleans things to a known state.
*/
static void ClearSerialPortBuffers(ISP_ENVIRONMENT *IspEnvironment)
{
#if defined COMPILE_FOR_LINUX
/* variables to store the current tty state, create a new one */
struct termios origtty, tty;

/* store the current tty settings */
tcgetattr(IspEnvironment->fdCom, &origtty);

// Flush input and output buffers
tcsetattr(IspEnvironment->fdCom, TCSAFLUSH, &tty);

/* reset the tty to its original settings */
tcsetattr(IspEnvironment->fdCom, TCSADRAIN, &origtty);
#endif // defined COMPILE_FOR_LINUX
#if defined COMPILE_FOR_WINDOWS || defined COMPILE_FOR_CYGWIN
PurgeComm(IspEnvironment->hCom, PURGE_TXABORT | PURGE_RXABORT |
PURGE_TXCLEAR | PURGE_RXCLEAR);
#endif // defined COMPILE_FOR_WINDOWS || defined COMPILE_FOR_CYGWIN
}
#endif // !defined COMPILE_FOR_LPC21





Tue Nov 6, 2007 8:49 pm

geschke
Offline Offline
Send Email Send Email

Forward
Message #189 of 429 |
Expand Messages Author Sort by Date

I was testing the lpc21isp program on Linux using a USB-to-serial converter as the interface to my development board and I think I found a bug in the...
geschke
Offline Send Email
Nov 6, 2007
8:59 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help