Hardware Handshaking

02 Nov 2010

Hello, according to the LCP1768 datasheet I found here:

www.nxp.com/documents/data_sheet/LPC1769_68_67_66_65_64_63.pdf

UART1 supports hardware handshaking, i.e. pausing transmission while a particular input line is high. As far as I can tell the supplied API doesn't support this (as stated by a few people on the forum). Is UART1 one of the exposed UARTs and if so where should I be looking for documentation on how to use the UARTs natively (I'm fairly new to microcontroller development and I don't really know where to look).

Many thanks for your help.

02 Nov 2010 . Edited: 02 Nov 2010

http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h

You can access the UART registers directly, for example LPC_UART1->LSR

See this for some guidance SerialBuffered

02 Nov 2010

 

@andy: Thanks ever so much for your (very swift) reply -- just what I needed!

For others and for the sake of reference, to enable CTS for UART1 (which is wired to pins 13,14 on the mbed) you must first set the function of pin 12 to be CTS1 (rather than GPIO or SPI etc.) which can be done by setting bits 3:2 of PINSEL1 to 01:

LPC_PINCON->PINSEL1 = ((LPC_PINCON->PINSEL1) & ~(3<<2)) | 1<<2;

(See: LPC1768 User Manual, Table 80, Bottom of Page 108)

Next enable automatic-CTS on UART1. This is set in the MCR (modem control register), bit 7:

LPC_UART1->MCR |= 1<<7;

(See: LPC1768 User Manual, Table 299, Top of Page 327)

 

The port can now be used as-per-usual but it will now take into account a CTS signal on pin 12, i.e. it will not transmit while pin 12 is high.

 

02 Nov 2010 . Edited: 02 Nov 2010

Jonathan,

Your welcome. And thanks for posting back, it's always great to see dusty dark corners of a big technical manual illuminated by the torch of wisdom :)

02 Oct 2013

Hi Andy and Jonathan,

Thank you so much guys for the issue with CTS. I am working with MBED and XBee series 2. I saw in LPC1768 User Manual where it talks about CTS (See: LPC1768 User Manual, Table 80, Bottom of Page 108) that you can also assign a MBED pin as RTS. I might need the RTS along with CTS in order to have flow control from both sides. Can you guys tell me what should I add in my code in addition to those two line Jonathan mentioned above? Also which pin of MBED I can assign for RTS?

Regards, Mahmud

03 Oct 2013

I added those two lines before main and it gave me lots of errors but, once I put them inside main it compiled without any error :).

03 Oct 2013

It worked perfectly. Didn't need any RTS. Only activating CTS solved my flow control problem. Thanks guys :)

03 Oct 2013

It worked perfectly. Didn't need any RTS. Only activating CTS solved my flow control problem. Thanks guys :)

04 Oct 2013

Hi Andy and Jonathan, I would still like to know what should be the code if I want to assign RTS and on which pin? Regards, Mahmud