µTasker Forum > Luminary Micro TM LM3SXXXX

Using The Serial Port in uTasker

<< < (2/2)

mark:
Hi Jez

The RTS/CTS flow control should be available as follows:

1) Enable SUPPORT_HW_FLOW so that the support is activated.
2) When you open the serial interface set the mode RTS_CTS as parameter.
3) This will configure GPIOs as RTS and CTS. In app_hw_lm3sxxxx.h you can specifiy which ports are used for the jobs - eg.

        #define CTS_0_PIN          PORTA_BIT3
        #define CTS_0_PORT_POWER   CGC_GPIOA
        #define CTS_0_PORT_ENABLE  GPIODEN_A
        #define CTS_0_PORT_DDR     GPIODIR_A
        #define CTS_0_PORT         PORT_A
        #define CTS_0_INT_PRIORITY 3

        #define RTS_0_PORT         GPIODATA_D
        #define RTS_0_PIN          PORTD_BIT1
        #define RTS_0_PORT_POWER   CGC_GPIOD
        #define RTS_0_PORT_ENABLE  GPIODEN_D
        #define RTS_0_PORT_DDR     GPIODIR_D

This is configuring CTS and RTS on UART0 on the pins PA-3 and PD-1. CTS is also given an interrupt priority since it is then automatically configured as a port interrupt and controls the transmit flow based on the state that it reads (with state change interrupts stopping and restarting the flow as appropriate).
If the input buffer gets critically full (number fo characters greater than the "high water level") the tty driver calls fnControlLine(Channel, CLEAR_CTS, tx_ctl->opn_mode); and the Stellaris driver then sets the defined GPIO stat eaccordingly (once the buffer becomes empty the RTS line is then automatically re-asserted).

Therefore I would expect that the RTS/CTS operation is fully implemented for your chip (the GPIO bit is generic so you can chose the pins that would like to assign).

Most of the RTS/CTS operation is described in http://www.utasker.com/docs/uTasker/uTaskerUART.PDF.

In chapter 8 in the same document there is a description of how RS485 is realised for chips that don't have automatic control. Usually it is necessary to use a timer to ensure that the line is accurately controlled, which is also valid for the Stellaris devices. The code reference in the document should be OK to control this - it is implemented like this in the MODBUS module, which has also used on Stellaris parts in RS485 mode.

Regards

Mark


jezc:
Hi Mark,

Thank you for such a prompt & informative response - I will try that (and probably prove the RTS/TS operation first, then move onto teh RS485) and ask if/when I get stuck!

Cheers,
    Jez

Navigation

[0] Message Index

[*] Previous page

Go to full version