> At 3:40 PM -0500 2000/05/16, Steve Branin wrote:
> >// set the baud rate to 9600
> >rate = 9600;
> >err = SrmControl(portID, srmCtlSetBaudRate, &rate, &ratesize);
> >
> >// copy my string into the send buffer and send it
> >StrCopy(sendBuffer, "This is a test.");
> >dataSent =  SrmSend(portID, &sendBuffer, 15, &err);
> >
> >//flush the FIFO
> >SrmSendWait(portID);
> >
> >// change the baud rate to 4800
> >rate = 4800;
> >err = SrmControl(portID, srmCtlSetBaudRate, &rate, &ratesize);
> >
> >When I do this, 95% of the time the end of my string is truncated.  If I
> >introduce a delay after the SrmSendWait then the code works fine.  I
suspect
> >that the SrmSendWait function isn't doing what it is supposed to...or
else I
> >am misunderstanding what it is supposed to do.  Can anybody shed some
light
> >on this?
>

Don't forget about the internal Q of the communications chip itself. The
SrmWait() function is simply waiting for all send data to be removed from
the software Q. The bytes are then Q's by the COM chip hardware (could be 16
bytes) and there is no way to know when this Q is empty. So you must do a
delay before switching baud rates or you will crush the bytes still pending
on the HW Q.

Steve.




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to