All Forums
 Microsoft Windows CE
 CE Drivers
 Using RS-485
 Forum Locked  Topic Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

akidder

1519 Posts

Posted - 17 Sep 2002 :  18:25:57  Show Profile  Email Poster
Q. How do I use the RS-485 drivers in CE?

Several ADS products include hardware to communicate via RS-485. To use the drivers, do the following:
  1. Set the board jumpers for RS-485 operation as shown in the user's manual.
    (Eg. The Graphics Client Plus uses jumpers JP8-JP11 and JP14-15 to set Serial Port 1 for RS-232 or RS-485 operation.)


  2. Add or change the following key in your ADSLOAD.REG file:

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial]
    "RS485"=dword:1

    For CE builds beginning late 2004:

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial]
    "SerialMode"=dword:1 ;0=RS232, 1=RS485, 2=RS422

  3. In your application, enable hardware handshaking:
        dcb.fOutxCtsFlow = TRUE;
    dcb.fRtsControl = RTS_CONTROL_TOGGLE; // XScale
    dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; // StrongARM

For related information, please see the Serial Communications topic index.

-----------------------
Drew Kidder
ADS Technology Transfer


Edited by akidder 17-Nov-2004: Update entries to match most recent driver releases, based on entries in this forum thread.

superiorcontrols

25 Posts

Posted - 26 Dec 2002 :  16:51:25  Show Profile  Email Poster
quote:
  • In your application, enable hardware handshaking:
        dcb.fOutxCtsFlow = TRUE;
    dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;


  • Does this apply to both HD and FD, or just FD? What are the corresponding values for HD? The Microsoft MSDN documentation for DCB says ...
    quote:
    fOutxCtsFlow
    Specifies whether the CTS (clear-to-send) signal is monitored for output flow control. If this member is TRUE and CTS is turned off, output is suspended until CTS is sent again.

    RTS_CONTROL_HANDSHAKE Enables RTS handshaking. The driver raises the RTS line when the "type-ahead" (input) buffer is less than one-half full and lowers the RTS line when the buffer is more than three-quarters full. If handshaking is enabled, it is an error for the application to adjust the line by using the EscapeCommFunction function.
    RTS_CONTROL_TOGGLE Specifies that the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low.

    Under 485 Half-Duplex/2-wire (for the GC+) this becomes very important because we have the carrier-control dance to manage. It would be useful to know what is really going on in the hardware.

    Questions:
    1. Will RTS_CONTROL_TOGGLE work instead of RTS_CONTROL_HANDSHAKE? In some systems, RTS does the carrier control under half-duplex operation. Is that the case with the GC+ and, if so, don't we want RTS to track the input buffer empty and not 1/2 full?

    2. What is the significance of the table in section 3.7.7 of the GC+ User's Manual describing the "SA-1110 GPIO lines to perform CTS/RTS handshaking"? Under RS-485 is shown RX Enable and TX Enable. Presumably the serial device driver is handling this for me as a result of the DCB settings described above. Is that true?

    BTW - The jumper diagrams in section 3.6.7 of the manual do NOT correspond to the actual positions of the jumpers on the board ... the order is incorrect. This is not an issue for RS-485 HD, but could lead to serious confusion for the FD case.
    Go to Top of Page

    akidder

    1519 Posts

    Posted - 24 Mar 2003 :  12:32:23  Show Profile  Email Poster
    [While we answered these questions in separate conversations, the rest of you might want to know this information, too.]

    Here are the short answers:

    1. Use RTS_CONTROL_HANDSHAKE for RS-485 mode. The RS-485 driver doesn't support toggle mode.

    2. The CE 485 driver uses GPIO 14 and 15 as outputs to RX and TX enable of the RS-485 transceiver, respectively.


    Background

    The ADS RS-485/422 drivers in Windows CE use the same data structures and drivers as RS-232. However, because 485 has different hardware and timing requirements than 232, we had to use a couple of GPIO lines and data structres in a non-232 fashion.

    For example, the 485 transceiver needs two digital outputs to control TX and RX enable. We reconfigure GPIO14 from its RS-232 use as an input(CTS1) and use it as RS-485 RX_enable; GPIO15 is used as TX_enable. In a similar way, while toggle mode more closely matches how 485 carrier control is handled, it's still not an exact match to 485 operation. ADS drivers use the handshake setting to indicate that RS-485 carrier control should be enabled.

    As for the error in the GC Plus serial jumper settings that you pointed out, take a look at the GC Plus user manual errata list at topic 202. The error is posted there. For quick reference, you might print out these lists and keep them with your manual. Let us know if you find other mistakes!

    Cheers, Drew
    Go to Top of Page

    ellewellyn

    9 Posts

    Posted - 22 Jun 2004 :  17:31:26  Show Profile  Email Poster
    I'm having trouble making this all work on the AGX board. I'm using the
    system in a 2 wire half-duplex mode. I'm able to transmit data
    to a PC through a 485 to 232 converter, but not able to receive data back.
    I followed the recommendations above, and as I said, was able to transmit
    a couple of bytes repeatably to the PC, but not able to receive any data,
    except the data that was echo'ed back.

    Any help appreciated,

    --Ed
    Go to Top of Page

    fiala

    4 Posts

    Posted - 22 Jun 2004 :  18:37:40  Show Profile  Email Poster
    The AGX CE Buid 4.10.05 had a few problems with RS-485. Make sure not to use this build for 485 applications

    Thanks
    Steven
    Go to Top of Page

    fiala

    4 Posts

    Posted - 23 Jun 2004 :  12:00:33  Show Profile  Email Poster
    To use RS-485 with boards with newer Xscale CPU, enable RTS Toggle not RTS Handshake.

    In your application, enable hardware handshaking:

    //SET RTS AND flow Control//
    DCB.fOutxCtsFlow = TRUE;
    DCB.fRtsControl = RTS_CONTROL_TOGGLE;

    Thanks Steven
    Go to Top of Page

    ellewellyn

    9 Posts

    Posted - 24 Jun 2004 :  10:57:29  Show Profile  Email Poster
    Thanks for the reply. I'm using CE 4.10.16, and I just tried RTS_CONTROL_TOGGLE - no success. When I call ClearCommError()
    to check for input, I get no input. Anything else to try? Does 4.10.16 support 485?

    Thanks,
    --Ed
    Go to Top of Page

    fiala

    4 Posts

    Posted - 17 Nov 2004 :  11:38:04  Show Profile  Email Poster
    All new CE builds for GCX, VGX, AGX, have made changes to RS 485 driver to better control the mode and response. You need to remove old Reg key and add the one below.


    ;=====================================================
    ; Sets serial mode on COM1.
    ;-----------------------------------------------------
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial]
    "SerialMode"=dword:0 ;0=use RS232, 1=use RS485, 2=use RS422
    ;-----------------------------------------------------

    You still have to set the flow control mode in the serial application.

    Thanks
    Steven, ADS
    Go to Top of Page
      Topic  
     Forum Locked  Topic Locked
     Send Topic to a Friend
     Printer Friendly
    Jump To:
    Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
    This page was generated in 0.03 seconds. Snitz Forums 2000