|
||
The power requirements of a standard serial port are not insignificant. The NS16550 UART, which is the standard component used for the serial ports on a PC, supplies a fairly modest 5.25V to the DTR and RTS modem control lines, which can draw up to 160mA each — in fact, this device is rated at 1W. WID serial ports have to provide the same functionality, and must therefore be considered potential power hogs.
In order to conserve battery power the serial hardware is kept switched off until the port is actually used. Using a port
consists of issuing a request to read from it or write to it. This means that even if the modem control lines have been explicitly
set high (using RComm::SetSignals()
), neither RTS nor DTR will have been asserted when the call completes.
Unfortunately, a situation could arise where a device plugged in to an WID serial port is in turn waiting for one of its input lines to go high before asserting its own outputs. If this happens at the same time as a running application is waiting for activity at the serial port before powering the port up, we have a clear case of deadlock.
The way to avoid this occurring is for the application to power the port up by issuing a dummy read or write request for zero bytes as soon as the port has been opened.