Silicon Laboratories SiM3U1xx User Manual

Browse online or download User Manual for Processors Silicon Laboratories SiM3U1xx. AN758: Implementing USB Communication Device

  • Download
  • Add to my manuals
  • Print
  • Page
    / 30
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 0
Rev. 0.1 3/13 Copyright © 2013 by Silicon Laboratories AN758
AN758
IMPLEMENTING USB COMMUNICATION DEVICE CLASS
(CDC) ON SiM3U1XX MCUS
1. Introduction
USB revolutionized the PC peripheral space by making a very simple plug-and-play interface for users. As a result,
many modern computers no longer support RS-232 serial COM ports, opting for the slimmer USB alternative. This
can be an issue for the developer who needs a COM port for communication between a peripheral and host PC. A
subset of the USB Communication Device Class (CDC) can be used to emulate a serial port providing a virtual
COM port UART interface. This allows developers to use legacy applications with new products using the same
COM port interface as before, with few hardware and software modifications.
Figure 1. USB CDC Virtual COM Port System
This application note describes the USB communications device class driver (or USB CDC) in detail and includes
an implementation example for the Silicon Labs SiM3U1xx MCU.
1.1. Assumptions
This document assumes the following:
A working knowledge of the C programming language.
Familiarity with the USB 2.0 specification and terms and abbreviations defined by the USB specification.
Familiarity with Silicon Labs SiM3U1xx development environment.
1.2. Features and Limitations
The CDC firmware implemented with this application note includes the following features:
Emulates a serial COM port on PC that supports the CDC Abstract Control Model (ACM).
Provides an abstract communication interface for data transfers between the host and the device.
Handles standard Chapter 9 USB device requests.
Handles CDC-specific requests from USB host.
Notifies the USB host of status using an interrupt endpoint.
Provides data communication with the USB host using a bulk endpoint.
The following baud rates are supported: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400,
460800, and 921600 bps.
The example does not implement the following:
No CTS/RTS control is performed, so flow control must be set to none in the terminal program.
RTS/DTR control is not implemented.
Serial Device
Host PC USB cable SiM3U1xx
RS232
cable
End device
Page view 0
1 2 3 4 5 6 ... 29 30

Summary of Contents

Page 1 - (CDC) ON SiM3U1XX MCUS

Rev. 0.1 3/13 Copyright © 2013 by Silicon Laboratories AN758AN758IMPLEMENTING USB COMMUNICATION DEVICE CLASS (CDC) ON SiM3U1XX MCUS1. IntroductionUSB

Page 2 - 3. USB CDC Class

AN75810 Rev. 0.15.1.6. CDC_Device_ReceiveByteUSB CDC receive one byte from USB OUT FIFO.Syntaxint16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_

Page 3 - Table 2. Line Coding Format

AN758Rev. 0.1 115.2. UART FunctionsThis section details the functions found in the gUART0.c file (AN758_USB_CDC\src\generated directory). Thisfile co

Page 4 - 3.2. Class Notifications

AN75812 Rev. 0.15.2.4. uart_send_dataUART0 send data.Syntaxvoid uart_send_data(unsigned char *data, unsigned int count)Parametersdata: pointer to send

Page 5 - 3.3. Endpoint Configuration

AN758Rev. 0.1 135.3. Application LayerThe application layer for the USB CDC firmware example can be found in the VirtualSerial.c and Descriptors.cfil

Page 6 - 4. Firmware Example Overview

AN75814 Rev. 0.15.3.4. EVENT_USB_Device_ControlRequestEvent handler for control request.Syntaxvoid EVENT_USB_Device_ControlRequest(void)ParametersNone

Page 7 - 5.1. CDC Functions

AN758Rev. 0.1 155.3.6. EVENT_USB_Device_ConfigurationChangedEvent handler for the library USB Configuration changed event.Syntaxvoid EVENT_USB_Device_

Page 8 - 8 Rev. 0.1

AN75816 Rev. 0.15.3.8. Macros#define ENDPOINT_DIR_IN 0x80#define ENDPOINT_DIR_OUT 0x00 /** Endpoint address of the CDC device-to-host notificat

Page 9 - Endpoint_ClearIN();

AN758Rev. 0.1 175.3.10. USB CDC DescriptorsDevice descriptor structure, this descriptor, located in flash memory, describes the overall device charact

Page 10 - 10 Rev. 0.1

AN75818 Rev. 0.1Example:const USB_Descriptor_Configuration_t ConfigurationDescriptor;String Descriptors#define STR0LEN 4static uint8_t const String0De

Page 11 - 5.2. UART Functions

AN758Rev. 0.1 195.4. USB Low-Level FunctionsThe USB hardware access layer functions are in the AN758_USB_CDC\src\LUFA\Drivers\USB\Core\SIM3Udirectory

Page 12 - 12 Rev. 0.1

AN7582 Rev. 0.12. Relevant DocumentationPrecision32™ Application Notes are listed on the following website: www.silabs.com/32bit-appnotes.AN667: Ge

Page 13 - 5.3. Application Layer

AN75820 Rev. 0.15.4.3. USB_Device_SetFullSpeedSet USB device as full speed.Syntaxstatic inline void USB_Device_SetFullSpeed(void)ParametersNoneReturn

Page 14 - 14 Rev. 0.1

AN758Rev. 0.1 215.4.6. USB_InitUSB hardware initialization.Syntaxvoid USB_Init(const uint8_t Options)ParametersOptions: USB Device Mode OptionReturn V

Page 15 - Rev. 0.1 15

AN75822 Rev. 0.15.4.9. USB0_epn_handlerHandle endpoint n request.Syntaxvoid USB0_epn_handler(void)ParametersNoneReturn ValueNoneDescriptionThis functi

Page 16 - 16 Rev. 0.1

AN758Rev. 0.1 235.4.11. Endpoint_ConfigureEndpointTableConfigure endpoint.Syntaxbool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const

Page 17 - Rev. 0.1 17

AN75824 Rev. 0.15.4.13. Endpoint_Write_Stream_LEWrite stream data to correspond endpoint.Syntaxuint8_t Endpoint_Write_Stream_LE(const void* const Buff

Page 18 - 18 Rev. 0.1

AN758Rev. 0.1 255.4.15. Endpoint_ClearOUTAcknowledges an OUT packet to the host on the currently selected endpointSyntaxstatic inline void Endpoint_Cl

Page 19 - 5.4. USB Low-Level Functions

AN75826 Rev. 0.16. CDC DriverThe CDC class is implemented in all releases of Windows, and the operating system needs an INF file for the CDCdriver. T

Page 20 - 20 Rev. 0.1

AN758Rev. 0.1 275. Select Browse my computer for driver software.

Page 21 - Rev. 0.1 21

AN75828 Rev. 0.16. Enter the directory path of the CDC_ACM.inf file (AN758_USB_CDC\src\VirtualSerial directory). If the Include subfolders option is

Page 22 - 22 Rev. 0.1

AN758Rev. 0.1 299. Open Device Manager and observe the device. It will now appear under Ports (COM & LPT) with an assigned COM port number.

Page 23 - Rev. 0.1 23

AN758Rev. 0.1 33.1.2. Get Line CodingThis request allows the host to find out the currently configured line coding. Table 2 defines the line codingpro

Page 24 - 24 Rev. 0.1

AN75830 Rev. 0.1CONTACT INFORMATIONSilicon Laboratories Inc.400 West Cesar ChavezAustin, TX 78701Tel: 1+(512) 416-8500Fax: 1+(512) 416-9669Toll Free:

Page 25 - Rev. 0.1 25

AN7584 Rev. 0.13.2. Class NotificationsTable 4 shows the class notifications supported by the Abstract Control Model.3.2.1. Serial StateThis notifica

Page 26 - 6. CDC Driver

AN758Rev. 0.1 53.3. Endpoint ConfigurationTable 6 illustrates the endpoint configuration for the Abstract Control Model.Figure 2 shows a standard CDC

Page 27 - Rev. 0.1 27

AN7586 Rev. 0.14. Firmware Example OverviewThe firmware example included with this application note contains the driver, USB stack for the SiM3U1xx,

Page 28 - 28 Rev. 0.1

AN758Rev. 0.1 75. Detailed List of FunctionsThis section discusses the detailed function declarations in the CDC USB stack firmware example.5.1. CDC

Page 29 - Rev. 0.1 29

AN7588 Rev. 0.15.1.2. CDC_Device_ConfigureEndpointsUSB CDC device endpoint configuration.Syntaxbool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_De

Page 30 - CONTACT INFORMATION

AN758Rev. 0.1 95.1.4. CDC_Device_SendByteUSB CDC sends one byte to USB IN FIFO.Syntaxuint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDC

Comments to this Manuals

No comments