What is Serial Port Contention?

Serial Port Contention occurs when ports are not available to open client applications. This topic outlines problems and suggests solutions that Serial Port Contention raises with the C32 Serial Server Client.

The Root Server process includes a server which allows access to the serial ports of a device. This server is known as C32 Serial Server and it sits on top of the Kernel RBusDevComm APIs. The RBusDevComm APIs provide access to the serial ports. Serial port configuration is important because each device has a specific hardware configuration and serial ports are highly susceptible to contention issues.

Serial port co-operation and contention

The first client to open a serial port effectively owns that port and can then choose to share it or keep exclusive access. This logic can cause problems for C32 Serial server clients. C32 Serial server clients cannot use RBusDevComm to track clients that use the serial ports directly. In these circumstances, C32 can only see that the port is in use and reports this to all of its clients.

To ensure a specified process can access a serial port, do one of the following:

  • Configure the device startup so that the specified process can open the serial port before all other applications.

  • Implement the serial port driver so that only the specified process can access it. For example, the driver might require that the client has a particular process ID.

Both of these solutions require an understanding of the serial port hardware and potential client software before the solutions can be implemented. For C32 Serial Server the device boot order is very important since it affects both solutions.

The C32 Serial Server is started after Root Server starts. The Root Server and C32 startups are specified in each associated CMI file. They are started early in the boot process, but the serial ports might be ready for use by RBusDevComm at an earlier stage. If the strategy of guaranteeing port access is based on the client opening the port using the C32 Serial Server, then no other client can open a port using RBusDevComm before C32 starts.

The C32 Serial Server loads plug-ins that act as high-level drivers for each serial port. You can implement any requirements for access within these plug-ins, such as requiring the client to have a specific process ID. This strategy only works within the C32 Serial Server, since any client using the serial port through RBusDevComm does not load the C32 Serial Server plug-in.