Megawin USB EasyCOM Index Megawin USB EasyCOM.... Introduction.... Advantage.... Use Megawin USB EasyCOM.... Application Circuit ( Fig-7 )...9 5. Example Application ( Fig-8 )...0 6. Obtaining the parts... 7. Pin Assignments... 8. Revision History...
. Introduction In the PC world, the UART is the industrial standard through out decades, but a lots of different connection protocol has getting stronger supports because the performance of UART is not catching up with current speed. However, many applications still use COM port as typical way to communicate with devices. Therefore, how could it be done to boost the performance, and pay less efforts to modify the current solutions? Fortunately, the USB (Universal Serial Bus) provides a new approach and offers more advantages to replace the standard COM port. This document will show user how to implement a solution, Virtual COM. It takes the current setting of COM, but also gives high speed performances. In this version, Megawin USB EasyCOM only support Read/Write data function. It does not support Line/Modem Control/Status features. These features will be provided in next version. In addition, Megawin not only just provides the simplest device, but also integrates some powerful peripherals into the same chip, such as: SPI, TWSI, and General IO. It helps user easily to control any devices on the system.. Advantage.. USB is on every new computer... No modification on the PC application... More flexibility on the USB: data buffering, no data lost, etc... USB provides the power supply for the application.5. Window Build-In driver on WinK, WinXP, Vista, Vista6.
. Use Megawin USB EasyCOM.. System Handle Block Megawin USB EasyCOM F/W Function Call User AP Standard COM Port APIs COM APIs EasyCOM F/W LIB USB_Read_Data_Complete User F/W AP Code USB_Send_Data_To_PC Megawin Provide Library MG8FL5BD.. Software Develop Requirements Used standard COM port APIs in OS defined... Firmware Develop Requirements... 0E6A06_USBEasyCOM_v.0.inf ( Driver Installation file )... EasyCOM.LIB ( Firmware Library File )... EasyCOM.H ( Firmware Header File )... DFU.EXE ( Device Firmware Upgrade Software )
.. Hardware install Plug the MG8FL5BD Evaluation Stick into a PC s USB port, and instruct Device Wizard where the installation 0E6A06_USBEasyCOM_v.0.inf file is located. After the driver is successfully installed, user will see the following page in the System\Hardware\Device Manager\, and see a new entry (COMn) added to the list of available COM ports. (Fig-).5. Including library file Fig-.5.. Add the EasyCOM.LIB into your own project. (Fig-).5... InFlag, in Extern.h ( This flag indicated that InLen data already in InBuffer ).5... InLen, in Extern.h ( Indicate the size of data in InBuffer ).5... InBuffer[6], in Extern.h ( Data Buffer ).5... Initial();, in Extern.h ( This function will enable USB and should be call in user project ).5..5. USB_Read_Data_Complete();, in Extern.h ( This function will release buffer for next data transfer from PC )
.5..6. USB_Send_Data_To_PC( Len, Buffer );, in Extern.h ( This function will send Len Data to PC ).5.. Include the Header file EasyCOM.H in the source modules which will use parameter or function call (Fig-), The following items could be modified by user application..5... USB_VID, in Define.h ( This VID is registered under Megawin Technology Co., Ltd. at USB-IF, Any third party needs the written approval from Megawin in order to use this VID ).5... MF_STRING, in Define.h ( Define for Manufacture String are supported ).5... PD_STRING, in Define.h ( Define for Product String are supported ).5... SN_STRING, in Define.h ( Define for SerialNumber String are supported ) Fig- ~\Megawin Easy USB\EasyCOM\SampleCode\MAIN.C
.6. Control Flow (Fig-) Fig-
.7. Used MCU resource (Fig-).7.. Direct Data Memory : bytes.7.. Indirect Data Memory : 7 bytes.7.. external Data Memory : 6 bytes.7.. Library Code size : 0 bytes.7.5. USB ISR use REG BANK Fig-
.8. Using Device Firmware Upgrade ( DFU.EXE ).8.. Short the R first, and then press the Reset button on MG8FL5BD Evaluation Stick..8.. Run DFU.EXE (Fig-5).8.. Load file which you want to upgrade.8.. Update to process upgrade procedure.9. Limitation Fig-5.9.. The application doesn t work with windows98/me and Linux OS..9.. Integrated 0 Bytes internal IAP for storing serial number or product string descriptor..9.. Crystal input should be force at Mhz. If user wants to use other frequency, Please contact Megawin technical support team..9.. Baud-rate: follow super I/O.
.0. MG8FL5BD Flash Memory Configuration on Evaluation Stick (Fig-6) 0x0000H Application Program 0xFFH 0x00H 0x7FFH 0x800H In Application Program In System Program 0xFFFH Fig-6. Application Circuit ( Fig-7 ) J 5 D N587 R U.5k USB Connector Vbus D- DM D+ DP GND C5 C6 5 5pF 5pF CON5 D+ D- VD USB_VDD5 VD C8 C9 0u 0.u AIC7- SOT89 VI VO C0 U 0.u GND USB_VDD5 VD C 0.uF R 0 R 0 VD P P P P0 P P P7 P6 P5 P XIN XOUT P0 P P0 P07 P06 RESET P05 P0 P0 P0 P0 P00 P7 P6 P5 P P R6 k R7 U5 LED0 U7 P0 P P0 P P P P P5 P6 P7 RESET P0 P P P P P5 P7 P6 P0 XIN C7 0.uF C 0u 5 6 7 8 9 0 U VDDA DP DM VSSA P. P. P. PLL_VDD PLL_CV P.0 P. P. 8 7 6 5 0 9 8 7 P.7 P.6 P.5 P. XIN XOUT VSS P.0 P. P.0 P0.7 P0.6 P. P. P.5 P.6 P.7 P. P. VDD_INT P.0 P. P. RST P0.5 P0. P0. P0. P0. P0.0 P.7 P.6 P.5 P. P. 6 5 0 9 8 7 6 5 SW C.0uF XIN XOUT U R 7k C C MHz 0pF 0pF J VD USB_VDD5 CON C 00pF 0k R5 C 000pF P P P5 5 P6 6 P7 7 P 8 P 9 0 P0 P P C C5 0.uF 0.uF MG8FL5BD_8LQFP VD R 0 P 5 6 7 8 9 0 5 6 7 8 9 0 U6 5 6 7 8 9 0 5 6 7 8 9 0 0 9 8 7 6 5 0 9 8 7 6 5 0 9 8 7 6 5 0 9 8 7 6 5 VD P00 P0 P0 P0 P0 P05 P06 P07 P P P P7 P6 P5 P P P P P0 P P0 R9 0 R0 0 TXD RXD J UART P0 J 5 CON5 k R8 k R k LED U8 LED U9 LED P P CON_MCU Fig-7
5. Example Application ( Fig-8 ) 5.. USB to MCU GPIO 5.. USB to UART 5.. USB to Parallel Port 5.. USB to SPI 5.5. USB to TWSI 5.6. USB to user s interface Fig-8
6. Obtaining the parts The MG8FL5BD device comes in a 8 pin surface mount LQFP-8 package. For this solution, it s only requires a MHz crystal, some passives, and the USB socket. Of course, customers could obtain it from Megawin in Taiwan. Please, visit the Megawin s website at http:// for the latest details on pricing and availability 7. Pin Assignments Pin Pin Name Type Description P.0 I/O General purpose digital I/O P. I/O General purpose digital I/O P. I/O General purpose digital I/O P. I/O General purpose digital I/O 5 P. I/O General purpose digital I/O 6 P.5 I/O General purpose digital I/O 7 P.6 I/O General purpose digital I/O 8 P.7 I/O General purpose digital I/O 9 RESET I Reset input, High Active 0 P.0 I/O General purpose digital I/O & TWSI_SCL P. I/O General purpose digital I/O & TWSI_SDA P. I/O General purpose digital I/O P. I/O General purpose digital I/O P. I/O General purpose digital I/O & SPI_ SSI 5 P.5 I/O General purpose digital I/O & SPI_ MOSI 6 P.7 I/O General purpose digital I/O & SPI_ SCLK 7 P.6 I/O General purpose digital I/O & SPI_ MISO 8 P.0 I/O General purpose digital I/O 9 XIN I Crystal Input 0 GND GND Power Ground P.0 I/O General purpose digital I/O & Serial port RXD P. I/O General purpose digital I/O & Serial port TXD P. I/O General purpose digital I/O & External interrupt 0 P. I/O General purpose digital I/O & External interrupt 5 P. I/O General purpose digital I/O,Timer 0 external input & Timer 0 clock output
6 P.5 I/O P.5 & Timer external input Pin Pin Name Type Description 7 P.6 I/O P.6 & External interrupt 8 P.7 I/O P.7 & External interrupt 9 P. I/O General purpose digital I/O 0 P. I/O General purpose digital I/O P. I/O General purpose digital I/O P0.7 I/O General purpose digital I/O & Keypad input 7 P0.6 I/O General purpose digital I/O & Keypad input 6 P0.5 I/O General purpose digital I/O & Keypad input 5 5 P0. I/O General purpose digital I/O & Keypad input 6 P0. I/O General purpose digital I/O & Keypad input 7 P0. I/O General purpose digital I/O & Keypad input 8 P0. I/O General purpose digital I/O & Keypad input 9 P0.0 I/O General purpose digital I/O & Keypad input 0 0 VD.Vdc.Vdc Output 8. Revision History Revision Description Data V.0 Initial version 007/09/7 V.0 Modify Control Flow 007/0/08 V.0 Modify Control Flow 007//6 Add user define USB_VID/USB_PID/USB/DID V.0 Modify Application Circuit and Pin assignment 007//0 V.0 Change driver name ( 0E6A06_USBEasyCOM_v.0.inf ) 008/0/