Now-a-days it is hard to find a physical COM port in laptops and fast disappearing in desktops, it will be convenient for the embedded developers to have an on-chip USB interface. The LPC1768 has a USB device interface and this example will enable the user to make it as a virtual COM port.
Universal serial Bus (USB), a connection technology for attaching peripheral devices to a computer, providing fast data exchange. USB connects more than computers and peripherals. USB gives you a single, standardized, easy-to-use way to connect up to 127 devices to a computer.
Below figure shows how to interface the USB to microcontroller. The USB is a 4 wire bus that supports communication between a host and a number (127 max.) of peripherals. In USB data cable Data+ and Data- signals are transmitted on a twisted pair. No termination needed. Half-duplex differential signaling helps to combat the effects of electromagnetic noise on longer lines. Contrary to popular belief, D+ and D- operate together; they are not separate simplex connections.
Fig. 1: Block Diagram Of USb Interfacing Microcontroller For Virtual Comport
Interfacing USB with LPC2148:
The LPC1768 controller enables 12 Mb/s data exchange with a USB host controller. It consists of register interface, serial interface engine, endpoint buffer memory and DMA controller. The input, output signals and a USB Bus are used to connect with controller. The LPC2148 controller read the USB voltage as power supply for controlling peripherals without having an external voltage. The LPC1768 USB takes supply voltage either from USB or external power supply by using a Jumper connection.
Circuit Diagram to Interface USB 2.0 with LPC1768:
Fig. 2: Circuit Diagram To Interface USB 2.0 Virtual Comport With LPC1768
To build this example, first download and extract the quick start code base.
Windows will ask for a driver the first time the device is used. The .inf file needed is in the library folder itself.
Fig. 3: Searching For Driver In Windows
Fig. 4: Browsing Driver Software In Windows
Windows 7 lacks terminal software. So, you’ll have to use a third party terminal software like, Arduino comport and putty. Whatever you may using you will need to know what number is assigned to the LPC1768 COM port. This can be seen in the Device manager.
Fig. 5: Number Assigned To LPC1768 COM Port Seen In Device Manager
As seen above, COM14 is what we will need to use for communicating with LPC1768 and USB-Serial converter is connected in COM6.
The USB and the UART-Serial are connected to the system, then two terminal software are opened for each separately. Here we are using putty and the Arduino IDE terminal software.
Fig. 6: Putty And Arduino IDE Terminal Software Window For Serial Communication
Any data entered to the COM6 will be reflected in the COM14 and vice versa.
Fig. 7: USB Virtual Comport Using LPC1768 Prototype