Half Duplex Flow Control

27 thoughts on “Half Duplex Flow Control

  1. Greetings,

     

      Perhaps someone on the forum has encountered the same dificulties as I.

    I´m trying to communicate a half duplex RS-485 equipment with the GC864QUADV2

    modem thru an RS-485 transceiver. I need to control de direction of data flow, but the CTS and RTS signals only activate on buffer overflow. I would like to know if this could be done by

    configuring the modem or if  by the contrary I would have to write a routine in 

    software to handle this, I´m using the IP_Easy to communicate the RS-485 slave with a remote

    master.

     

    Regards,

     

    Haroldo Calvo 

     

    1. Maybe you can use a modem GPIO to control the direction, or you can use AT#V24CFG and AT#V24 to manipulate individual serial port pins.

       

      1. Hi Cosmin, 

         

          Thanks for the help, I have attached the CTS pin to the RE and TE pins on the

        transceiver so I think I will go with your second suggestion. Could you give me any

        hints as  how to detect when data is going to be transmitted in the serial port in data mode? 

         

        Best Regards,

         

        Haroldo Calvo 

          1. Hi Cosmin,

             

            You mean like sending the data direction command from the remote host app, then the

            data and then once again the data direction command?. If that is the case there is no warranty 

            that the commands will arrive before the data, at least not for PSD(packet switched data).

             

            Couldn´t I just monitor the modem´s serial port tx buffer for data and raise the data direction flag accordingly? If this is feasible how could it be acomplished in parallel with regular data mode in IP_Easy?

             

            Best Regards,

             

            Haroldo Calvo 

          2. Hi Cosmin,

             

            You mean like sending the data direction command from the remote host app, then the

            data and then once again the data direction command?. If that is the case there is no warranty 

            that the commands will arrive before the data, at least not for PSD(packet switched data).

             

            Couldn´t I just monitor the modem´s serial port tx buffer for data and raise the data direction flag accordingly? If this is feasible how could it be acomplished in parallel with regular data mode in IP_Easy?

             

            Best Regards,

             

            Haroldo Calvo 

          3. Cosmin,

             

              Here are some examples of hardware and software solutions to the problem:

             

            Hardware Solution (RS232 to RS485 Converter):

            Pros: Quick to implement 

            Cons: Fixed Baud rate for schmitt trigger scheme

            Cons:  If a microcontroller is used a variable baud rate could be achieved but this

            increases BOM.

             

            Software Solution :

            Instead of using IP easy, use a phyton script to interface between the serial port and

            the socket and set the CTS signal accordingly.

             

            Pros: No additional hardware 

            Cons: Fixed baud rate, Responses from the slave could be lost if the delay

            in setting data direction is large.

             

            I wonder if it is possible to get acces to the ASC0 UART flags, to monitor

            the TX buffer flags and change data direction?? 

             

            Here´s a link to info on the subject:

            http://www.moxa.com/resource_file/857220091121341.pdf 

          4. I don’t think the low access to the module UART flags is possible so the quickest, feasible, low term but portable solution would be the hardware converter.

             

          5. Hi Cosmin,

             

              Well that is unfortunate, older half duplex modems implemented data direction control thru the RTS/CTS pins. I guess I will have to modify my hardware design.

             

            Thanks for the advice

             

            Regards, 

             

            Haroldo Calvo 

          6. Hi Haroldo,

             

            I think the easy way to do it is to let the device to MASTER the communication, ie use the same line used for RE TE to stop data sending out from module by means of flow control (line connected to RTS of module) so when device need to trnasmit it stop data coming from module.

          7. Hi Luca,

             

            The thing is that the device connected to the module has an RS-485  serial interface, so there is no RTS signal available. Also I´m using an isolated RS-485 transceiver so that option would imply an extra opto-isolator. I´m attaching an image of my circuit for your review.

             

             Regards,

             

            Haroldo Calvo 

          8. Hi Haroldo,

            I meant not to use the RTS of your device, I understood you don’t have it.

            I meant to select a GPIO to be used to select Tx Rx  and the same to be used to stop send data aout from module

          9. Hi Luca,

             

              Pardon me, I missunderstood, I see. Well that is possible indeed but how would I know exactly when to

            activate the GPIO? when is there data to be Tx and when has it all been transmited?

            and suppose I do know when I´m going to transmit data thru the serial port, would the

            program execution be fast enough as to deactivate the transmitter in time to listen to the slave response?

             

            You stated that the same GPIO PIN could be used to stop sending data out from the module, how could this be acomplished?

             

            As Cosmin pointed  out the CTS pin can be used as a GPIO thru the V24 command

            so control over the pin should be no issue, then I guess I should try to make a program 

            that receives data thru a socket, activates the Data Direction control PIN, then sends this received data thru the serial port and then changes the Data Direction PIN once again, waits for data thru the serial port and receives it and the sends it thru the socket.

            All the functionality already comprised on IP_easy  but with the added Data Direction Control.

             

            Thanks for your quick reply and advice

             

            Kind regards,

             

            Haroldo Calvo 

          10. Hi Haroldo,

            I meant you use a GPIO form your uC drived directly to both EN TxRx of converter and the  RTS of the module. So this way when you have to trnasmit you stop module from sending any data to prevent collision and at the same time you enable the Tx direction on the converter. When finished to trnasmit data toggle this line so you chenge direction on converter and at the same time you allow module to transmit data if any. I believe this should be the easy way to do it; of course you must know when YOU have data to be transmitted out form uC.

          11. Hi Luca,

             

              When I tried the AT# RS485? command I got an error response, I guess it is not

            supported on my firmware version:

             

            at+cgmr

            10.00.053


            OK 

             

            My module model is GC864QUADV2

             

            I was thinking of trying this modified script, taken from the SKT_CL_SR.py example:

             

            while MDM.getDCD() == 1:

                b = SER.read()

                s=""

                res = MDM.send(b, 10)

                s = MDM.read() 

                SER.setCTS(1)

                rs = SER.send(s)

                SER.setCTS(0) 

                MOD.sleep(2) # 50 

             

            And try it at different serial bus speeds see how it goes. 

             

             

             

          12. Hi Luca,

             

              Yes, in my board I do have access to the ASC1 interface. How do I obtain

            the latest FW version? shall I talk to my distributor? (Rutronik).

             

            Regards,

             

            Haroldo Calvo 

          13. Hi Cosmin, Luca,

             

              Thanks for the link, will download it and give it a try to the firmw upgrade.

            Any hints on the use of AT#RS485? I don´t see any reference to the command

            in the current documentation. 

             

            Regards

             

            Haroldo Calvo 

          14. Hi Cosmin,

             

              After downloading the latest ATcommandsReferenceGuide I checked the AT#RS485 

            command functionality, but I don´t have the xfp tool to download the new firmware.

            The firmware update is performed thru ASC0 or ASC1? 

             

            Regards, 

             

            Haroldo Calvo 

          15. Hi Cosmin,

             

             I tried to flash the new firmware using xfp ver2_0_13 with no success. After completing about 70% of the programming I get the error on the attached image.  I tied the service pin to Ground

            connected my RS232 to USB converter to Txtrace and Rxtrace, hit the program button and a second later turned the module ON  after wich the software showed the programming  bar advancing.

             

            Any suggestions?

             

            Regards,

             

            Haroldo Calvo 

          16. Hi Cosmin,

             

              After downloading and installing the new Xfp version I tried to program the new

            firmware with the same results, I got an error after aprox 70% of the programming.

            Later on I REMOVED THE RTC LITHIUM BATTERY on my platform and the firmware

            programming completed with succes (attached picture). It is important to REMOVE

            the RTC battery when performing a firmware upgrade, I was not aware of that!!

             

            Regards,

             

            Haroldo Calvo 

  2. Hi,

     

    I was searching for the command #RS485 in my ATCommandsReferenceGuide but I think my device doesn’t support it. I’m using the HE910.

     

    I want to communicate using RS485 too, but in the case I’m sending data I won’t know when it stop, so I couldn’t use an GPIO to control the RE/ and TE pins. I mean, if I put HIGH an GPIO (that is controlling the TE and RE/ of the RS485 transceiver -like the max485-), I’ll send data, but if I put LOW the same pin, the transmission will stop and I’ll start to receive data, but I won’t know if I did send all the data (because I did change it too fast), or in the other case (assuming I did send all the data, but I wait too long to change the GPIO’s state) I won’t know if the other devices answer me, so maybe the data that I received from the other devices is uncompleted. 

     

    The #RS485 command is perfect for this scenario, because it tells you when the data transmission has finished, so in the moment that the data transmission has finished, I could change the GPIO state to start receiving the outcoming data. 

     

    Is there any command that works like the #RS485 command, but that is compatible with the HE910?  

     

    If any of you can help me, I’ll appreciate.  

    Thank you,

     

    Andrés Gollini 

  3. Hi,

     

    I was searching for the command #RS485 in my ATCommandsReferenceGuide but I think my device doesn’t support it. I’m using the HE910.

     

    I want to communicate using RS485 too, but in the case I’m sending data I won’t know when it stop, so I couldn’t use an GPIO to control the RE/ and TE pins. I mean, if I put HIGH an GPIO (that is controlling the TE and RE/ of the RS485 transceiver -like the max485-), I’ll send data, but if I put LOW the same pin, the transmission will stop and I’ll start to receive data, but I won’t know if I did send all the data (because I did change it too fast), or in the other case (assuming I did send all the data, but I wait too long to change the GPIO’s state) I won’t know if the other devices answer me, so maybe the data that I received from the other devices is uncompleted. 

     

    The #RS485 command is perfect for this scenario, because it tells you when the data transmission has finished, so in the moment that the data transmission has finished, I could change the GPIO state to start receiving the outcoming data. 

     

    Is there any command that works like the #RS485 command, but that is compatible with the HE910?  

     

    If any of you can help me, I’ll appreciate.  

    Thank you,

     

    Andrés Gollini 

  4. Hi,

     

    I was searching for the command #RS485 in my
    ATCommandsReferenceGuide but I think my device doesn’t support it. I’m using
    the HE910.

     

    I want to communicate using RS485 too, but in the case
    I’m sending data I won’t know when it stop, so I couldn’t use an GPIO to
    control the RE/ and TE pins. I mean, if I put HIGH an GPIO (that is controlling
    the TE and RE/ of the RS485 transceiver -like the max485-), I’ll send data, but
    if I put LOW the same pin, the transmission will stop and I’ll start to receive
    data, but I won’t know if I did send all the data (because I did change it too
    fast), or in the other case (assuming I did send all the data, but I wait too
    long to change the GPIO’s state) I won’t know if the other devices answer me,
    so maybe the data that I received from the other devices is uncompleted. 

     

    The #RS485 command is perfect for this scenario,
    because it tells you when the data transmission has finished, so in the moment
    that the data transmission has finished, I could change the GPIO state to start
    receiving the outcoming data. 

     

    Is there any command that works like the #RS485
    command, but that is compatible with the HE910?  

     

    If any of you can help me, I’ll appreciate.  

    Thank you,

     

    Andrés
    Gollini