MPS430 - UART Interfacing with flow control (RTS/CTS)

Discussion in 'Embedded Systems and Microcontrollers' started by miguelon, Jun 21, 2014.

  1. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    Hi,
    I'm trying to use a FTDI VNC to give a microcontroler (Texas MSP430) USB capabilities. I connect both via UART.
    The VNC2 uses a UART with flow control RTS/CTS and the MSP doesn't use it, so I guess I have to emulate using some GPIO (General Purpose Input/Output) pins (with interrupt capabilities) on MSP430 so they can comunicate each other.
    I'm trying to understand how RTS/CTS lines works but I haven't been able to understand it completely with USER manuals from FTDI.

    The lines are cross-connected so VNC_TX connects to MSP_RX, VNC_RX to MSP_TX, VNC_RTS to MSP_CTS and VNC_CTS to MSP_RTS. As suggested on FTDI user manual.

    RTS= Request to send
    CTS= Clear to send.
    TX= Transmition Line.
    RX= Reception Line.

    The MSP sends commands and VNC responds with data.

    How the MSP430 initiate the communication?. Just activating the RTS line (MSP_RTS). and waiting the other side responds activating the CTS line(VNC_RTS)?, or RTS line is used just to allow/stop the data on RX line.

    Any help would be appreciated.
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
  3. dougc314

    Member

    Dec 20, 2013
    38
    11
    Typically RTS passes through to the other equipment, telling it to get ready for data and to signify that by asserting CTS. Which side originates RTS depende on who is the Data Terminal Equipment (DTE) end. This is termed hardware handshaking and both sides need to be set up for that. Typically the RX end of RTS and CTS would be serviced by a software interrupt routine. You haven't specified which MS430 or FDTI chip. The FT232RL USP UART has CTS as a input and RTS as an output. Presumably then the MCU would be set up as Data Comincations Equipment (DCE). When data starts to happen on the USB BUS RTS gets assreted to the MCU, it gets interrupted, (or is polling) gets ready to RX data and asserts CTS. This is all software in the MCU, which you can probably find in a library. The wikipedia article on RS232 will get you started on learning about this. Another way is to just set up the UART in the MCU to interrupt when its receiving a byte. Most serial links work this way. However if you are trying to go fast, or if the MCU has other higher priority tasks that keep it busy you can loose data without hardware handshake. Please understand that while I can answer this question as far as I have I am not a software developer by trade and so can only give you the basics.
     
    miguelon likes this.
  4. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    Thanks for your answer.

    I am using the Texas MSP430F2416 and FTDI Vinculum-II.

    The Vinculum is used to extract data from a usb memory stick and it sends to the MSP430 via UART.

    I pretend use a fast baud rate ( approx 500 kbps). So maybe I can miss data If the RTS/CTS lines is not correctly asserted.

    Vinculum also works as a DTE?. (Vinculum-II woks as a Host Controller)

     
  5. dougc314

    Member

    Dec 20, 2013
    38
    11
    Well, took a quick look at that part, it's very complicated and beyond my ability to help, I'd turn that one over to my embedded guy!. I did look at the FTDI parts data sheet, UART_RTS is a I/O pin, which implies to me that there is a configuration register that sets up that part to do what the system designer/programmer decided to do. It may be dynamic.

    Try googling your FTDI part and "Arduino" or "ATMEGA" to see if any of the Arduino or ATMEGA users have used that part and explain how they did it. Also FTDI may have C-code libraries and application notes to support that part.
     
    miguelon likes this.
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Who uses flow control these days? You're not working with 1960's data terminals or something? :eek:

    Just use two devices with standard serial RX and TX.
     
    miguelon likes this.
  7. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    FTDI Vinculum II need flow control to work or at least that is what I have read from the firmware's manual from FTDI I am using.

    I also pretend use a baud rate as high as I can to improve the speed of the design and that forces me to use flow control to avoid overflows.

    Do you think that I don't need flow control for high baud rates?.

    If it really wasn't necessary could simplify the software

     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    Flow control is used when the receiver cannot keep up with the transmitter.
    Most systems today can handle just about any data rate without flow control.
    I use 460800 baud consistently without flow control and never have a problem.
     
  9. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    I've finally understood how it works.


    It use a DTE-DTE UART communication. Both sides send and receive data. The lines for the flow control have to be cross-connected.

    MSP_RTS# (output) <----> VNC_CTS# (input)
    MSP_CTS# (input)<----> VNC_RTS# (output)

    CTS# and RTS# are active when are low '0'

    1. When the MSP part wants to initiate a communication firtsly check the MSP_CTS# pin. If MSP_CTS# = '0' (VNC_RTS# ='0' --> VNC can accept data form VNC_RX), it send data from MSP_TX to VNC_RX (Can send data while MSP_CTS#='0').

    2. When the VNC execute the command and has data to send back, do the same. Check the VNC_CTS# pin and If it is '0' send data from VNC_TX to MSP_RX (can send data while VNC_CTS#='0')
     
  10. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    Oops, I didn't see your post. I'll try the simpler option as you suggest.

    Thanks you all for your help.


     
  11. josip

    Member

    Mar 6, 2014
    63
    12
    There are low cost entry level MSP430F550x family with USB hardware module (with transfer rate up to 1 MByte/s), lower price with smaller board and less parts on it. Don't see any reason for FTDI / MSP430 combo.

    MSP430 hardware UART can go over 1 Mbps (http://forum.43oh.com/topic/3413-msp430-uart-benchmark), and there is no need for flow control. My MSP430F550x based USB-UART bridge (http://forum.43oh.com/topic/3350-msp430f550x-based-usb-uart-bridge) transfer over 1 Mbps without flow control. But there is USB-UART bridge (up to 1 Mbps) used in open source TI eZ-FET Lite (http://processors.wiki.ti.com/index.php/EZ-FET_lite) that use flow control, so you can check there how it is done.
     
    miguelon likes this.
  12. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    I've used this combo because FTDI has a firmware developed so I can use it without any programming. It implement a transparent bridge USB-UART (the USB port only has to support USB memory sticks). I only have to send commands to the FTDI and it answers sending the file system structure of the disk (name of the files and directories) or the data stored in a file from the usb memory stick (That is all I need from the memory stick). So "I think" it is easy to use.

    Anyway, I'll take a look at the links you have posted. Thanks for your interest

     
    THE_RB likes this.
  13. josip

    Member

    Mar 6, 2014
    63
    12
    It is not completely clear to me how FTDI / MSP430 is used with USB memory stick, but there are also open source examples with TI USB stack (http://www.ti.com/tool/msp430usbdevpack), where MSP430F55xx is used as USB memory stick (M1_Example) using internal flash or external SD card (M2_Exmple), whatever.
     
    miguelon likes this.
  14. miguelon

    Thread Starter New Member

    May 20, 2014
    11
    1
    In FTDI website there are several free firmware (the firmware code can be modified as you need, if needed) that can be uploaded on Vinculum II chip that makes this task (USB-Memory bridge, in this case) in a transparent way to the designer. You only have to know which pin must be wired in your own design (between FTDI and MSP430). With the board design done, your microcontroller only have to send commands (Like a Command-line interface) to FTDI chip and wait to receive the data asked.

    Josip thanks again for your tips.

     
Loading...