Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?

[Ideas For Design]

Add Self-Detection To Serial Devices



Contributing Author  |   ED Online ID #6233  |   February 22, 1999

Article Rating: Not Rated

Perhaps one of the most popular methods for communications between a personal computer and an external device is serial asynchronous communication, based on the RS-232 standard. The external device may be: development tools, debugging tools, measurement equipment, data acquisition, etc.,which are only occasionally connected to the PC. That’s because other more frequently used resources, such as a mouse, an external modem, or a trackball, need access to the limited number of serial ports. When it’s time to connect one of these lower-priority devices, confusion often arises over which COM port the device should be configured for.

Presented here is an interesting solution to consider for new designs. It involves a little extra hardware attached to the serial device, and a little extra software attached to the application on the PC.

The idea is to generate a ringing signal that can be detected by the PC application. In this way, the application can automatically detect the COM port at which the external device appears on.

The typical communication between a PC and a serial sevice uses only three wires: Rx, Tx, and ground. The MAX232 chip has four level translators. Only two are used to perform the link described—one for the received data (RS-232 to TTL translator) and one for the transmitted data (TTL to RS-232 translator). This leaves two available translators.

The RS-232 to TTL-level translator employed in the circuit has a special feature—a hysteresis of approximately 0.5 V. With this feature, a classical gate oscillator can be created (Fig. 1a). This oscillator may be built using the spare translators in the MAX232 (Fig. 1b). As shown in Figure 2, the oscillator output (with its RS-232 level) is connected to pin 9 of a DB-9 connector (or pin 22 of a DB-25 connector). This pin performs the Ring Indicator (RI) signal function on the RS-232 interface.

Now we have to create the software (see the listing) to be added to the PC application. The function to be performed needs to detect if the oscillation is present on the RING input of serial port that’s polled.

To do this, it begins polling each serial port controller (8250-based or 16x50-based UART), checking whether the oscillation described is present by reading the RING INDICATOR bit in the Modem Status Register (MSR). When this oscillation is detected, the device has been identified and is ready!

The SearchOscillator() function counts the number of times in a second that an edge on input signal RI is produced by checking bit 2 in MSR. This bit (called “TERI,” or Tailing Edge of Ring Indicator) indicates that the RI input has changed from low to high. This count is saved into the ringCount variable, and must be equal to the oscillator frequency.

A frequency detection band (“F_MAX, F_MIN”) is created to perform the oscillation detection more effectively. The time interval for this edge counting is indicated using the searchTimeOut global flag variable. It’s set to TRUE in the timer interrupt service routine, when the desired time (one second approximately) has passed. This function also is useful for verifying whether the serial device is powered or not. The DetectSerialDevice() function is used to poll for the possible serial ports mapped into the PC. It returns the I/O base address of the device that has been detected via the oscillator frequency signature.

The approach presented has been used successfully in several designs. It’s had success because it’s easy to implement, has no cost penalties, and eliminates user confusion and errors when configuring serial devices to the PC’s COM ports.

Protocols of higher level could be used (using Rx and Tx lines), when the serial device is identified, creating a simulated “Plug & Play” system.




Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


  • Network-On-Chip Tools Arrive for The Masses
  • Tackling System Design Challenges Through Early Verification
  • ESL Tools Take Center Stage As Designers Move Up
  • Parasitic Extraction Tool Targets Next-Generation Custom ICs
  • Synopsys Jumps Into ESL-Synthesis Pool
  • Verify Control Systems Before Committing To Hardware
  • You're Using How Many FPGAs?
  • Tool Up For The FPGA Blitz
    1) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (179 views today)
    2) Hot Hands For Some Cool Rock: Motion Sensing Meets Audio Engineering
    (167 views today)
    3) What's All This Transimpedance Amplifier Stuff, Anyhow? (Part 1)
    (83 views today)
    4) GPS-Derived Grandmaster Clock Delivers Ultra-Precise Time And Frequency Sync
    (71 views today)
    5) Bidirectional H-Bridge DC-Motor Motion Controller
    (58 views today)
    ALL TOP 20







    POST YOUR COMMENTS HERE

    Name:

    Email:
    Rate this article:

     less useful more useful 
    1
    2
    3
    4
    5
    Your Comments:

    Enter the text from the image below




    Please refresh the page if you have trouble reading this text.
    (Acceptable Use Policy)
     
     

    PartFinder

    Find real-time pricing, stock status, same-day/next-day shipping options and more. Brought to you by Digi-Key. Go to PartFinder.    
    GlobalSpec

    PART SEARCH :
    Powered by: GlobalSpec - The Engineering Search Engine
    Sponsored Links

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources