I'm having problems sending data via RS232 with my Tungsten T3 running OS 5.2.1. The strange thing is that I have a Zire 71 and Tungsten T2, both with OS 5.2.1, as well as several OS 4.x devices and the code works fine on all of these. I've performed a serial (RS232) HotSync with the T3, so it doesn't appear to be a bad serial port. Here's what I'm seeing on the T3 (see code below):
1) serPortInit() executes without any errors
2) message is built in code that's not shown without errors
3) serMsgTransmit() executes (no errors), but data does not appear on the line
4) another message is built
5) serMsgTansmit() starts execution, but T3 locks up and hangs after it reaches SrmSendFlush()
6) need to Soft Reset the T3 to get it out of the lock-up
Any help would be much appreciated!
Thanks! Kraig
Global Variables: SerSettingsType m_serSettings; UInt m_serRefNum;
Boolean serPortInit(Boolean sendSoundCmd)
{
Err error;
UInt tempInt;// Initialize the Settings Vars
m_serSettings.baudRate = 9600;
m_serSettings.ctsTimeout = 1;
m_serSettings.flags = (srmSettingsFlagBitsPerChar8 | srmSettingsFlagStopBits1 | srmSettingsFlagRTSAutoM);
// Initialize the Serial Manager
error = SrmOpen(serPortCradleRS232Port, m_serSettings.baudRate, &m_serRefNum);
if(error)
{
SrmClearErr(m_serRefNum);
FrmAlert(SysErrSerCantOpenAlert);
return true;
}
// initialize the serial port baud rate
tempInt = sizeof(m_serSettings.baudRate);
error = SrmControl(m_serRefNum, srmCtlSetBaudRate, &m_serSettings.baudRate, &tempInt);
if(error)
{
SrmClearErr(m_serRefNum);
FrmAlert(SysErrSerValuesAlert);
return true;
}
// initialize the serial port settings
tempInt = sizeof(m_serSettings.flags);
error = SrmControl(m_serRefNum, srmCtlSetFlags, &m_serSettings.flags, &tempInt);
if(error)
{
SrmClearErr(m_serRefNum);
FrmAlert(SysErrSerValuesAlert);
return true;
}
// initialize the serial port cts timeout
tempInt = sizeof(m_serSettings.ctsTimeout);
error = SrmControl(m_serRefNum, srmCtlSetCtsTimeout, &m_serSettings.ctsTimeout, &tempInt);
if(error)
{
SrmClearErr(m_serRefNum);
FrmAlert(SysErrSerValuesAlert);
return true;
}
// clear any pending serial errors SrmClearErr(m_serRefNum);
// Initialize serial buffer handle m_serRxBufferHandle = MemHandleNew(SER_BUFF_SIZE);
// Lock down the handle and get pointers to the memory chunk. m_serRxBuffer = (CharPtr)MemHandleLock(m_serRxBufferHandle);
// Clear UART buffer StrCopy(m_serRxBufferHandle, "");
return false; }
Boolean serMsgTransmit(CharPtr txBuffer, UInt occ)
{
Err status = 0;
Boolean errorStatus = false;// Flush Tx and Rx buffer SrmReceiveFlush(m_serRefNum, 0); SrmSendFlush(m_serRefNum);
// Send data to port SrmSend(m_serRefNum, txBuffer, occ, &error);
if(error) status = true; // Error occured
return status; }
_________________________________________________________________
Page a contact�s mobile phone with MSN Messenger 6.0. Download it now FREE! http://msnmessenger-download.com
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
