Hello!
I´m using RS485 2-wire communication and found the following behaviour of
the serial port driver:
The condition for RS485 communication in both directions is to set
dcb.fRtsControl = RTS_CONTROL_TOGGLE.
Now sending some bytes over the serial port depends on the speed of the
processor. Using a Geode GX2 and 115200 baud the bytes are all sent. Using a
GeodeLX and 115200 baud the last byte is not sent correctly. Using the
GeodeGX2 with slower baudrate eg. 110 baud the last byte is also not
correctly sent.
This behaviour is caused by the Com_Write Function in mdd.c which clears the
RTS without waiting for the Transmitter Empty Flag of the Line Status
Register.
So i made the following changes:
if ( pSerialHead->DCB.fRtsControl == RTS_CONTROL_TOGGLE ) {
// Patch
if(pFuncTbl->HWGetLSR != NULL)
while(!(pFuncTbl->HWGetLSR(pHWHead) & 0x40)); // wait for
Transmitter Empty (TEMT) Flag
// End Patch
pFuncTbl->HWClearRTS(pHWHead);
}
HWGetLSR is a extension of the HW_VTABLE Struct, which is linked with the
included SerGetLSR Function in cserpdd.c.
The SerGetLSR Function uses the GetLineStatus Function in pdd16550.cpp.
The functions are implemented like the HWClearRTS and SerClearRTS functions.
Now the serial RS422 2-wire communications works well.
Regards,
Andy