Content originally posted in LPCWare by micrio on Mon Jan 16 20:35:03 MST 2012
I am trying to get the auto-flow control working with the UART on a LPC1114/301. I am working with auto-RTS first.
When I disable flow control the UART works OK with both Tx and Rx. So that is not a problem.
When I initialize the modem lines with this code;
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Setup handshake lines.[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2] LPC_IOCON->[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_7[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] &= ~0x07; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* UART I/O [U]config[/U] */[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2] LPC_IOCON->[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_7[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= 0x01; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* UART CTS */[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2] LPC_IOCON->[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO1_5[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] &= ~0x07; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* UART I/O [U]config[/U] */[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2] LPC_IOCON->[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO1_5[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= 0x01; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* UART RTS */[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][SIZE=2] LPC_UART->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MCR[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = BIT_6; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* Set auto RTS active. */[/COLOR][/SIZE][/COLOR][/SIZE][/SIZE]
the RTS line will be active (observed with a scope). Everything looks good.
Then I run. I will take a bunch of interrupts with the IIR returning RLS (Receive Line Status). The LSR register will be 0xF9 indicating framing error. This will repeat many times until the RTS pin will go low, it was perviously high. Reseting the FIFO does not prevent this. There is no data being sent into the Rx input, this is all during initialization. This seems OK so far?
After the RTS pin goes low, strangely the Rx pin will also go low. The Rx pin is being driven by the LPC1114 chip not my ASYNC device. This is very weird because the Rx pin is an input not an output. I have looked at the UART configuration registers and they look OK.
Why would the Rx line be driven low by the LPC1114?
Has anyone had success with auto-flow control?
I have not yet tried auto-CTS so I don't know if that works. The example code provides a modem setup which is what I am using. I am using the interrupt handler from the example. The example works OK until you try auto-flow control. The example includes the modem setup code but does not use it.
------------------------------------------------------
There is a bug in LPCXpresso. The register definition for the MCR register in the UART has a bit defined wrong. The RTS_Control bit is listed as bit 2 where the manual says it is bit 1. The manual is correct.
Thanks,
Pete.