This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UART comm w/ hardware flow control code?

Other Parts Discussed in Thread: LM3S6965

Hi All,

Does anyone know where I can find some sample UART (RS232) comm code that uses hardware flow control? There doesn't seem to be anthing about it in the forums - or did I just miss it?

I've tweeked the uart_echo.c code to run via interrupts, but I haven't got flow control yet.

My project is to collect "real time" telemetry more or less constantly, and remotely control a R/C - vehicle. For now I'm using a pair of XBee Pro's running RS232 at 9600 N81. But since the transmission range is variable, and XBee's are radio, I'm figuring I'll need some kind of CRC (ECC?) which might tax the processor. Hence, flow control.

I'm leaning towards hardware flow control because Xon/Xoff seems like such an inelegant waste of bandwidth.

Any thoughts? Advice?

Thanks,
Jim
  • Welcome aboard - you will shortly love the power/capabilities of these LMI micros. Be patient - much more "set-up" code (monkey-motion) than with 8 bit - but once implemented you will enjoy the power...

    Believe more detail than "cookbook" will serve you better - long term. Best resources are chip's Data Manual, Peripheral User's Guide (600+ pgs - sectioned very nicely) and code examples under Uart.

    Hardware flow-control uses CTS and RTS - key your study to glean when/why/how these signals assert. Believe that 2 3S102 micros or 2 simple pcbs will speed/ease your study - enabling experimentation.

    I'm past educater - urge you to master your communication AND flow control BEFORE implementing radio. Better one challenge at a time - too many variables yields delay & confusion - at least for my simple mind.

    Good luck & post us on your progress - many smart/generous contributors will assist...

    Post edited by: cb1, at: 2008/07/25 07:57
  • Thanks for the welcome, cb1. Your docs recommendation and general advice is appreciated.

    I neglected to say that I'm using an 6965 rev A eval board, and already have the XBee's working. Brainless, really.

    It's just that darn CTS/RTS. I'll get it tho.
  • Hi,

    The configurable FIFO interrupt trigger levels will help you with RTS/CTS control, although at 9600 I doubt if you would have any trouble processing all the information you need with the 6965 even if you use a CRC. Assuming you're running it at full speed.

    The UART block used by Luminary is very good, one thing I like is that you don't have to check error status separately, it gives you error information in the upper bits of the FIFO data. So if you have a comms problem you know which bytes are good or bad in the FIFO without any extra work.

    I use some spare GPIO for RTS/CTS on one of my ports, but haven't got around to writing the code to control them yet, even at 115,200 and beyond I don't appear to need it, although having proper control is always a better plan!

    Regards,

    Liam.
  • I'm working on a UART software module at the moment.
    At 50MHz system clock, it can handle 1200Baud -> 3MBaud (max) OK - including CRC, although that's a lot of interrupts @3MBaud!
    Will be using UART module for RF comms, so only 20kBaud required. Easy work for the LM processor.
  • Hi Derek,

    Thanks for your multiple, valued contributions. Believe that one can never supply "too much" detail/explanation - I am still amazed at the fair/proper questions which remain after I thought I had clearly explained things.

    Re: your sw Uart - may I suggest an I2C or SPI instead? (better yet - a selectable sw port) Most LMI devices have multiple hw Uarts! (some have three)

    Few LMI have 2 I2C and 2 SPI - which is valuable for "chip to chip" communication - when each micro requires "unswitched access" to SPI/I2C accessories. Having to "switch/share" an SPI/I2C port slows traffic while adding a management layer and complications.

    Believe this will be more welcome - keep up your valued work...
  • hello cb1

    Yes I'm using the LM3S6965 - it has 3 h/w UARTs, and the UART s/w module will use all 3 (or more). Then, an RF s/w module can utilise (via UART s/w module) one h/w UART for wireless comms, using a standard rf pcb package. While at the same time you can connect the other 2 h/w UARTs up for wired comms to other things - all with one UART s/w module ...