Hi Techies,
Presently we are working on USB to Serial driver on LPC2468 OEM board with Keil uVision IDE.The Modem signal pins are avilable for UART1 and connected to LPC2468 uController.We integrated our CDC and UART driver to work as USB to Serial driver, where the data transfer is working successfully.
But we don't know how to handle the Modem signals, for example if we want to handle the Hardware and software flowcontrol in UART,How to implement in software UART driver.
We have a SEND_BREAK class request in CDC, when we get this request we set the Break Control bit in U1LCR with some delay.Now the question is when we have to clear this Break Control bit U1LCR? For your information when we set this bit , we get Break interrupt in UART for Line status Register(U1LSR),this we give as a notification through Interrupt IN pipe to HOST.
When we have to set RTS and DTR bits in U1MCR and when we have to clear? We have U1TEN (Transmit Enable Register)used for software and hardware flow control, for sending the data throught UART, what about Receving of data through UART.
How we can know that an application is using the software or hardware flow control?
What is the procedure to handle the flowcontrol mechanisim in UART?
How to Test UART Driver independently with Modem using Modem signals?
"We have a SEND_BREAK class request in CDC, when we get this request we set the Break Control bit in U1LCR with some delay.Now the question is when we have to clear this Break Control bit U1LCR?"
See the CDC spec on USB.org "Class definitions for Communication Devices 1.2" www.usb.org/.../CDC1.2_WMC1.1.zip
6.3.13 SendBreak (CDC1.2_WMC1.1\usbcdc12\PSTN120.pdf rev1.2 p25) The wValue field contains the length of time, in milliseconds, of the break signal. If wValue contains a value of FFFFh, then the device will send a break until another SendBreak request is received with the wValue of 0000h.
"When we have to set RTS and DTR bits in U1MCR and when we have to clear?"
It's the time when you receive SetControlLineState request.
6.3.12 SetControlLineState (CDC1.2_WMC1.1\usbcdc12\PSTN120.pdf rev1.2 p25) Table 18: Control Signal Bitmap Values for SetControlLineState D1: Carrier control for half duplex modems. This signal corresponds to V.24 signal 105 and RS-232 signal RTS. D0: Indicates to DCE if DTE is present or not. This signal corresponds to V.24 signal 108/2 and RS-232 signal DTR.
"How we can know that an application is using the software or hardware flow control?"
The CDC spec doesn't define any way to handle flow control. As the USB spec has intrinsic flow control over the IN/OUT bulk pipe using NAK, I suppose there is no need to define it.
Of course, you can implement the RS232 specific flow control on the UART by the firmware. In this case, SEND_ENCAPSULATED_COMMAND and GetEncapsulatedResponse requests will support to carry the flow control setting and status.
6.2.1 SendEncapsulatedCommand (CDC1.2_WMC1.1\usbcdc12\CDC120.pdf rev1.2 p21) 6.2.2 GetEncapsulatedResponse
"How to Test UART Driver independently with Modem using Modem signals?"
Loopback connection.
As you can see, the all information about CDC implementation lies in the CDC spec. However, it is difficult to specify the place where the required information is described on this spec.
I recommend you to find it using 'full' search of Acrobat. For example, when you enter the keyword "RTS" on the full search of PSTN120.pdf, you'll find just single match, above one. In this way, you can quickly reach to the required information without any effort :-)
Tsuneo
Thanks Tsuneo,
We read all the documents mainly PSTN120.pdf,which has good explanation. We have doubts in lpc2469 user manual for UART1, regarding some of the registers and how to use in our application.
When we open the hyperterminal, we are gettng the SET_CONTROL_LINE_STATE request with wValue = 3 (DTR and RTS are present).
DTR indicates that Terminal(PC) is ready.
What about RTS, it indicates that Terminal(PC) is using hardware flow control.
We are setting the DTR and RTS bits in U1MCR bits and enabled the Modem interrupts , then we have to get the DSR and CTS changes in U1MSR register, Is it correct?I think we are wrong here?
How can we implement the Hardware flow control in UART software driver(No CDC please)?
What is the use of U1TER and the bits RTSen, CTSen in U1MCR registes?
In the manual RTSen, CTSen bits are for Auto-flow control, so if we set these bits then hardware will take care of flow control.
What exacly is "If auto-cts mode is enabled this bit enables/disables the modem status interrupt generation on a CTS1 signal transition. If auto-cts mode is disabled a CTS1 transition will generate an interrupt if Modem Status Interrupt Enable (U1IER[3]) is set.
In normal operation a CTS1 signal transition will generate a Modem Status Interrupt unless the interrupt has been disabled by clearing the U1IER[3] bit in the U1IER register. In auto-cts mode a transition on the CTS1 bit will trigger an interrupt only if both the U1IER[3] and U1IER[7] bits are set"
We have a CTSInterrupt Enable bit in U1IER register which will generate an interrupt, when CTSen bit is set in U1MCR and Modem status interrupt is enabled.
For example we won't enable the CTSInterrupt and won't set the CTSen bit, but we get an interrupt and read the U1MSR, which shows that change is CTS, What does it mean?
What is the use of CTS, DSR, RI, DCD bits 4,5,6,7 in U1MSR? Can you provide any sample logic or skelton program to implement the flowcontrol mechanisim while transfering and receiving the data with UART?
"Can you provide any sample logic or skelton program to implement the flowcontrol mechanisim while transfering and receiving the data with UART?"
It depends on the device driver on the PC. - Which OS? Windows, Linux or MacOSX? - And which OS version, Win2k, XP, Vista, and which SP? - Which device driver are you working on? Windows buit-in usbser.sys?
We have Windows XP SP2, usbser.sys.
We have LPC2468 OEM board with USB Device controller and UART1. We developed the USB CDC with ACM and UART driver both in interrupt context.We developed the interface between UART and CDC.
UART side we connceted the TI 56Kb Modem and loaded the driver for the modem and at PC side using the Hypertermial or TeraTerm Pro.
In the control panel, we added the modem to our virtual CDC com port.
Now tell me how to test the CDC and UART driver with Flow control?When we have to set and clear the registers in UART for handling the flow control?