SILICON LABS Programming USB Device Module User Guide

SILICON LABS Programming USB Device Module User Guide

સિલિકોન-લેબ્સ-લોગો

SILICON LABS Programming USB Device Module

SILICON-LABS-Programming-USB-Device-Module-PRODUCT

વિશિષ્ટતાઓ

  • Product: USB Device Module
  • Function: USB device programming
  • ઉત્પાદક: સિલિકોન લેબ્સ

ઉત્પાદન વપરાશ સૂચનાઓ

USB ઉપકરણ મોડ્યુલ શરૂ કરી રહ્યા છીએ
Begin by initializing the USB device module core using the function sl_usbd_core_init(). Check for any errors using the returned status.

વર્ગ(ઓ) શરૂ કરી રહ્યા છીએ
After initializing the USB device core, initialize each class you intend to use. Refer to the Programming Guide of your specific class for more information.

તમારું USB ઉપકરણ બનાવી રહ્યા છીએ

રૂપરેખાંકનો ઉમેરી રહ્યા છીએ
Start by adding a configuration to your device. Use  sl_usbd_core_add_configuration() to add a configuration with necessary parameters like speed, power consumption, etc.

Example - તમારા ઉપકરણમાં રૂપરેખાંકન(ઓ) ઉમેરવાનું

  • sl_status_t status; uint8_t config_nbr_fs; status = sl_usbd_core_add_configuration(0, 100u, SL_USBD_DEVICE_SPEED_FULL, “Config Add Example Full-Speed config”, &config_nbr_fs); if (status != SL_STATUS_OK) { // Error handling }

USB ફંક્શન(ઓ) ઉમેરી રહ્યા છીએ
Once you have added a configuration, you can add interfaces and endpoints to your device. Each USB class has specific requirements for interfaces and endpoints.

Example – તમારા ઉપકરણમાં ક્લાસ ઇન્સ્ટન્સ ઉમેરવું

  • sl_status_t status; uint8_t class_nbr; status = sl_usbd__create_instance(&class_nbr); if (status != SL_STATUS_OK) { // Error handling }

આ વિભાગ કોમ્યુનિકેશન્સ ડિવાઇસ ક્લાસ (CDC) ક્લાસ અને સિલિકોન લેબ્સના USB ડિવાઇસ સ્ટેક દ્વારા સપોર્ટેડ સંકળાયેલ CDC સબક્લાસનું વર્ણન કરે છે. સિલિકોન લેબ્સ USB-ડિવાઇસ હાલમાં એબ્સ્ટ્રેક્ટ કંટ્રોલ મોડેલ (ACM) સબક્લાસને સપોર્ટ કરે છે, જેનો ઉપયોગ સામાન્ય રીતે સીરીયલ ઇમ્યુલેશન માટે થાય છે.

સીડીસીમાં વિવિધ ટેલિકોમ્યુનિકેશન અને નેટવર્કિંગ ઉપકરણોનો સમાવેશ થાય છે. ટેલિકોમ્યુનિકેશન ઉપકરણોમાં એનાલોગ મોડેમ, એનાલોગ અને ડિજિટલ ટેલિફોન, આઇએસડીએન ટર્મિનલ એડેપ્ટર વગેરેનો સમાવેશ થાય છે. ઉદાહરણ તરીકેampલેસ, નેટવર્કિંગ ઉપકરણોમાં ADSL અને કેબલ મોડેમ, ઇથરનેટ એડેપ્ટર અને હબ હોય છે. CDC USB લિંકનો ઉપયોગ કરીને V.250 (ટેલિફોન નેટવર્ક પર મોડેમ માટે) અને ઇથરનેટ (સ્થાનિક ક્ષેત્ર નેટવર્ક ઉપકરણો માટે) જેવા હાલના સંચાર સેવાઓના ધોરણોને સમાવિષ્ટ કરવા માટે એક માળખું વ્યાખ્યાયિત કરે છે. સંચાર ઉપકરણ ઉપકરણ વ્યવસ્થાપન, જરૂર પડે ત્યારે કોલ વ્યવસ્થાપન અને ડેટા ટ્રાન્સમિશનનો હવાલો સંભાળે છે.

સીડીસી ઉપકરણોના સાત મુખ્ય જૂથોને વ્યાખ્યાયિત કરે છે. દરેક જૂથ સંદેશાવ્યવહારના એક મોડેલનો છે, જેમાં અનેક પેટા વર્ગો શામેલ હોઈ શકે છે. સીડીસી બેઝ ક્લાસ ઉપરાંત ઉપકરણોના દરેક જૂથનો પોતાનો સ્પષ્ટીકરણ દસ્તાવેજ હોય ​​છે. સાત જૂથો છે:

  • Public Switched Telephone Network (PSTN), devices including voiceband modems, telephones, and serial emulation devices.
  • Integrated Services Digital Network (ISDN) devices, including terminal adaptors and telephones.
  • Ethernet Control Model (ECM) devices, including devices supporting the IEEE 802 family (ex.: cable and ADSL modems, WiFi adapters).
  • Asynchronous Transfer Mode (ATM) devices, including ADSL modems and other devices connected to ATM networks (workstations, routers, LAN switches).
  • Wireless Mobile Communications (WMC) devices, including multi-function communications handset devices used to manage voice and data communications.
  • Ethernet Emulation Model (EEM) devices which exchange Ethernet-framed data.
  • Network Control Model (NCM) devices, including high-speed network devices (High Speed Packet Access modems, Line Terminal Equipment)

સીડીસી અને સંકળાયેલ સબક્લાસ અમલીકરણ નીચેના સ્પષ્ટીકરણોનું પાલન કરે છે:

  • Universal Serial Bus, Class Definitions for Communications Devices, Revision 1.2, November 3 2010.
  • Universal Serial Bus, Communications, Subclass for PSTN Devices, Revision 1.2, February 9 2007.

યુએસબી ડિવાઇસ સીડીસી બેઝ ક્લાસ ઓવરview

સંદેશાવ્યવહાર ક્ષમતાને અમલમાં મૂકવા માટે CDC ઉપકરણ નીચેના ઇન્ટરફેસોથી બનેલું છે:

  • Communications Class Interface (CCI) is responsible for the device management and optionally the call management. The device management enables the general configuration and control of the device and the notification of events to the host. The call management enables calls establishment and termination. Call management might be multiplexed through a DCI. A CCI is mandatory for all CDC devices. It identifies the CDC function by specifying the communication model supported by the CDC device. The interface(s) following the CCI can be any defined USB class interface, such as Audio or a vendor-specific interface. The vendor-specific interface is represented specifically by a DCI.
  • Data Class Interface (DCI) is responsible for data transmission. Data transmitted and/or received do not follow a specific format. Data could be raw data from a communication line, data following a proprietary format, etc. All the DCIs following the CCI can be seen as subordinate interfaces.

A CDC device must have at least one CCI and zero or more DCIs. One CCI and any subordinate DCI together provide a feature to the host. This capability is also referred to as a function. In a CDC composite device, you could have several functions. Therefore, the device would be composed of several sets of CCI and DCI(s) as shown in Figure – CDC Composite Device.

આકૃતિ - સીડીસી કમ્પોઝિટ ડિવાઇસ

SILICON-LABS-Programming-USB-Device-Module-FIG- (1)

સીડીસી ઉપકરણ નીચેના અંતિમ બિંદુઓના સંયોજનનો ઉપયોગ કરે તેવી શક્યતા છે:

  • A pair of control IN and OUT endpoints called the default endpoint.
  • An optional bulk or interrupt IN endpoint.
  • A pair of bulk or isochronous IN and OUT endpoints. Note that Silicon Labs USB device stack does not currently support isochronous endpoints.

નીચે આપેલ કોષ્ટક વિવિધ અંતિમ બિંદુઓનો ઉપયોગ અને CDC ના કયા ઇન્ટરફેસ દ્વારા તેનો ઉપયોગ થાય છે તે દર્શાવે છે.

કોષ્ટક - સીડીસી એન્ડપોઇન્ટ ઉપયોગ

અંતિમ બિંદુ દિશા ઈન્ટરફેસ ઉપયોગ
નિયંત્રણ IN Device-to-host CCI Standard requests for enumeration, class-specific requests, device management, and optionally call management.
નિયંત્રણ બહાર Host-to-device CCI Standard requests for enumeration, class-specific requests, device management, and optionally call management.
Interrupt or bulk IN Device-to-host CCI ઇવેન્ટ્સ નોટિફિકેશન, જેમ કે રિંગ ડિટેક્ટ, સીરીયલ લાઇન સ્ટેટસ, નેટવર્ક સ્ટેટસ.
Bulk or isochronous IN Device-to-host ડીસીઆઈ કાચો અથવા ફોર્મેટ કરેલ ડેટા સંચાર.
Bulk or isochronous OUT Host-to-device ડીસીઆઈ કાચો અથવા ફોર્મેટ કરેલ ડેટા સંચાર.
  • મોટાભાગના સંદેશાવ્યવહાર ઉપકરણો ઇવેન્ટ્સના હોસ્ટને સૂચિત કરવા માટે ઇન્ટરપ્ટ એન્ડપોઇન્ટનો ઉપયોગ કરે છે. જ્યારે USB પ્રોટોકોલ ભૂલોના કિસ્સામાં માલિકીનો પ્રોટોકોલ ડેટા રીટ્રાન્સમિશન પર આધાર રાખે છે ત્યારે ડેટા ટ્રાન્સમિશન માટે આઇસોક્રોનસ એન્ડપોઇન્ટનો ઉપયોગ ન કરવો જોઈએ. આઇસોક્રોનસ સંદેશાવ્યવહાર સ્વાભાવિક રીતે ડેટા ગુમાવી શકે છે કારણ કે તેમાં કોઈ પુનઃપ્રયાસ પદ્ધતિ નથી.
  • સંદેશાવ્યવહારના સાત મુખ્ય મોડેલોમાં અનેક પેટા વર્ગોનો સમાવેશ થાય છે. એક પેટા વર્ગ ઉપકરણ સંચાલન અને કોલ વ્યવસ્થાપનને હેન્ડલ કરવા માટે ઉપકરણે CCI નો ઉપયોગ કેવી રીતે કરવો જોઈએ તેનું વર્ણન કરે છે. નીચે આપેલ કોષ્ટક બધા શક્ય પેટા વર્ગો અને તેઓ કયા સંચાર મોડેલ સાથે સંબંધિત છે તે દર્શાવે છે.

કોષ્ટક - સીડીસી પેટા વર્ગો

 
પેટા વર્ગ કોમ્યુનિકેશન મોડેલ Exampઆ પેટા વર્ગનો ઉપયોગ કરતા ઉપકરણોની યાદી
Direct Line Control Model PSTN USB હોસ્ટ દ્વારા સીધા નિયંત્રિત મોડેમ ઉપકરણો
એબ્સ્ટ્રેક્ટ કંટ્રોલ મોડલ PSTN સીરીયલ ઇમ્યુલેશન ડિવાઇસ, સીરીયલ કમાન્ડ સેટ દ્વારા નિયંત્રિત મોડેમ ડિવાઇસ
ટેલિફોન નિયંત્રણ મોડેલ PSTN વૉઇસ ટેલિફોની ઉપકરણો
Multi-Channel Control Model ISDN બેઝિક રેટ ટર્મિનલ એડેપ્ટર્સ, પ્રાઇમરી રેટ ટર્મિનલ એડેપ્ટર્સ, ટેલિફોન
CAPI Control Model ISDN બેઝિક રેટ ટર્મિનલ એડેપ્ટર્સ, પ્રાઇમરી રેટ ટર્મિનલ એડેપ્ટર્સ, ટેલિફોન
Ethernet Networking Control Model ECM DOC-SIS cable modems, ADSL modems that support PPPoE emulation, Wi-Fi adaptors (IEEE 802.11-family), IEEE 802.3 adaptors
ATM Networking Control Model એટીએમ ADSL modems
વાયરલેસ હેન્ડસેટ નિયંત્રણ મોડેલ ડબલ્યુએમસી વાયરલેસ ઉપકરણો સાથે કનેક્ટ થતા મોબાઇલ ટર્મિનલ સાધનો
ઉપકરણ સંચાલન ડબલ્યુએમસી વાયરલેસ ઉપકરણો સાથે કનેક્ટ થતા મોબાઇલ ટર્મિનલ સાધનો
મોબાઇલ ડાયરેક્ટ લાઇન મોડેલ ડબલ્યુએમસી વાયરલેસ ઉપકરણો સાથે કનેક્ટ થતા મોબાઇલ ટર્મિનલ સાધનો
ઓબેક્સ ડબલ્યુએમસી વાયરલેસ ઉપકરણો સાથે કનેક્ટ થતા મોબાઇલ ટર્મિનલ સાધનો
Ethernet Emulation Model EEM Devices using Ethernet frames as the next layer of transport. Not intended for routing and Internet connectivity devices
નેટવર્ક નિયંત્રણ મોડલ NCM IEEE 802.3 adaptors carrying high-speed data bandwidth on network

કોર તરફથી USB ઉપકરણ CDC ACM વર્ગ સંસાધન જરૂરિયાતો
Each time you add a CDC ACM class instance to a USB configuration via a call to the function sl_usbd_cdc_acm_add_to_configuration(), the following resources will be allocated from the core.

 
સંસાધન જથ્થો
ઇન્ટરફેસ 2
Alternate interfaces 2
અંતિમ બિંદુઓ 3
Interface groups 1
  • Note that those numbers are per configuration. When setting up your SL_USBD_INTERFACE_QUANTITYSL_USBD_ALT_INTERFACE_QUANTITYSL_USBD_INTERFACE_GROUP_QUANTITY અને SL_USBD_DESCRIPTOR_QUANTITY configuration values, don’t forget to take into account on how many configurations the class will be added. For the SL_USBD_OPEN_ENDPOINTS_QUANTITY configuration value, since endpoints are opened only when a configuration is set by the host, you just need to take into account the number of needed endpoints for a class instance.

યુએસબી ડિવાઇસ સીડીસી એસીએમ સબક્લાસ ઓવરview

  • The CDC base class is composed of a Communications Class Interface (CCI) and Data Class Interface (DCI), which is discussed in detail in USB Device CDC Base Class Overview . આ વિભાગ ACM પ્રકારના CCI ની ચર્ચા કરે છે. તેમાં મેનેજમેન્ટ એલિમેન્ટ માટે ડિફોલ્ટ એન્ડપોઇન્ટ અને નોટિફિકેશન એલિમેન્ટ માટે ઇન્ટરપ્ટ એન્ડપોઇન્ટનો સમાવેશ થાય છે. DCI પર અનિશ્ચિત ડેટા વહન કરવા માટે બલ્ક એન્ડપોઇન્ટ્સની જોડીનો ઉપયોગ થાય છે.

ACM સબક્લાસનો ઉપયોગ બે પ્રકારના સંચાર ઉપકરણો દ્વારા થાય છે:

  • Devices supporting AT commands (for instance, voiceband modems).
  • Serial emulation devices which are also called Virtual COM port devices.

There are several subclass-specific requests for the ACM subclass. They allow you to control and configure the device. The complete list and description of all ACM requests can be found in the specification “Universal Serial Bus, Communications, Subclass for PSTN Devices, revision 1.2, February 9, 2007”, section 6.2.2.

From this list, Silicon Labs’ ACM subclass supports the following:

કોષ્ટક - સિલિકોન લેબ્સ દ્વારા સમર્થિત ACM વિનંતીઓ

 
Subclass Request વર્ણન
SetCommFeature આપેલ સંચાર સુવિધા માટે સેટિંગ્સને નિયંત્રિત કરવા માટે હોસ્ટ આ વિનંતી મોકલે છે. સીરીયલ ઇમ્યુલેશન માટે ઉપયોગમાં લેવાતું નથી.
GetCommFeature આપેલ સંચાર સુવિધા માટે વર્તમાન સેટિંગ્સ મેળવવા માટે હોસ્ટ આ વિનંતી મોકલે છે. સીરીયલ ઇમ્યુલેશન માટે ઉપયોગમાં લેવાતું નથી.
ClearCommFeature આપેલ સંચાર સુવિધા માટે સેટિંગ્સ સાફ કરવા માટે હોસ્ટ આ વિનંતી મોકલે છે. સીરીયલ ઇમ્યુલેશન માટે ઉપયોગમાં લેવાતું નથી.
સેટલાઇન કોડિંગ હોસ્ટ ACM ડિવાઇસ સેટિંગ્સને ગોઠવવા માટે આ વિનંતી મોકલે છે: બાઉડ રેટ, સ્ટોપ બિટ્સની સંખ્યા, પેરિટી પ્રકાર અને ડેટા બિટ્સની સંખ્યા. સીરીયલ ઇમ્યુલેશન માટે, જ્યારે પણ તમે ઓપન વર્ચ્યુઅલ COM પોર્ટ માટે સીરીયલ સેટિંગ્સ ગોઠવો છો ત્યારે આ વિનંતી સીરીયલ ટર્મિનલ દ્વારા આપમેળે મોકલવામાં આવે છે.
ગેટલાઇનકોડિંગ હોસ્ટ વર્તમાન ACM સેટિંગ્સ (બૉડ રેટ, સ્ટોપ બિટ્સ, પેરિટી, ડેટા બિટ્સ) મેળવવા માટે આ વિનંતી મોકલે છે. સીરીયલ ઇમ્યુલેશન માટે, સીરીયલ ટર્મિનલ્સ વર્ચ્યુઅલ COM પોર્ટ ઓપનિંગ દરમિયાન આ વિનંતી આપમેળે મોકલે છે.
SetControlLineState The host sends this request to control the carrier for half-duplex modems and indicate that Data Terminal Equipment (DTE) is ready or not. In the serial emulation case, the DTE is a serial terminal. For a serial emulation, certain serial terminals allow you to send this request with the controls set.
સેટબ્રેક હોસ્ટ RS-232 સ્ટાઇલ બ્રેક જનરેટ કરવા માટે આ વિનંતી મોકલે છે. સીરીયલ ઇમ્યુલેશન માટે, ચોક્કસ સીરીયલ ટર્મિનલ્સ તમને આ વિનંતી મોકલવાની મંજૂરી આપે છે.

Silicon Labs’ ACM subclass uses the interrupt IN endpoint to notify the host about the current serial line state. The serial line state is a bitmap informing the host about:

  • Data discarded because of overrun
  • સમાનતા ભૂલ
  • ફ્રેમિંગ ભૂલ
  • State of the ring signal detection
  • State of break detection mechanism
  • State of transmission carrier
  • State of receiver carrier detection

Silicon Labs’ ACM subclass implementation complies with the following specification:

  • યુનિવર્સલ સીરીયલ બસ, કોમ્યુનિકેશન્સ, PSTN ઉપકરણો માટે સબક્લાસ, પુનરાવર્તન 1.2, 9 ફેબ્રુઆરી, 2007.

USB ઉપકરણ CDC ACM વર્ગ રૂપરેખાંકન
આ વિભાગ CDC ACM ક્લાસ (કોમ્યુનિકેશન ડિવાઇસ ક્લાસ, એબ્સ્ટ્રેક્ટ કંટ્રોલ મોડેલ) ને કેવી રીતે ગોઠવવું તેની ચર્ચા કરે છે. રૂપરેખાંકન પરિમાણોના બે જૂથો છે:

  • USB ઉપકરણ CDC ACM વર્ગ એપ્લિકેશન વિશિષ્ટ રૂપરેખાંકનો
  • USB ઉપકરણ CDC ACM વર્ગ ઇન્સ્ટન્સ રૂપરેખાંકનો

USB ઉપકરણ CDC ACM વર્ગ એપ્લિકેશન વિશિષ્ટ રૂપરેખાંકનો

  • સીડીસી બેઝ ક્લાસ
  • ACM સબક્લાસ

સીડીસી બેઝ ક્લાસ

  • સૌપ્રથમ, સિલિકોન લેબ્સ યુએસબી ડિવાઇસ સીડીસી ક્લાસ મોડ્યુલનો ઉપયોગ કરવા માટે, તમારે તમારી એપ્લિકેશન જરૂરિયાતો અનુસાર સીડીસી કમ્પાઇલ-ટાઇમ ગોઠવણી #define-s ને સમાયોજિત કરવાની જરૂર પડશે. તેમને sl_usbd_core_config.h હેડરની અંદર ફરીથી જૂથબદ્ધ કરવામાં આવે છે. file CDC વિભાગ હેઠળ. તેમનો હેતુ USB ઉપકરણ મોડ્યુલને કેટલા USB CDC ઑબ્જેક્ટ ફાળવવા તે અંગે માહિતી આપવાનો છે.
  • નીચે આપેલ કોષ્ટક આ રૂપરેખાંકન માળખામાં ઉપલબ્ધ દરેક રૂપરેખાંકન ક્ષેત્રનું વર્ણન કરે છે.

કોષ્ટક - USB ઉપકરણ CDC રૂપરેખાંકન વ્યાખ્યાયિત કરે છે

 
રૂપરેખાંકન નામ વર્ણન ડિફૉલ્ટ મૂલ્ય
SL_USBD_CDC_CLASS_INSTANCE_QUANTITY ફંક્શનને કોલ કરીને તમે ફાળવશો તે ક્લાસ ઇન્સ્ટન્સની સંખ્યા sl_usbd_cdc_acm_create_instance(). 2
SL_USBD_CDC_CONFIGURATION_QUANTITY Number of configurations. ACM class instances can be added to one or more configurations via a call to the sl_usbd_cdc_acm_add_to_configuration(). 1
SL_USBD_CDC_DATA_INTERFACE_QUANTITY Total number of data interfaces (DCI) for all the CDC functions. Each CDC ACM function added via a call to the function sl_usbd_cdc_acm_create_instance() will add a data interface. 2

ACM સબક્લાસ

ACM સબક્લાસમાં નીચેના કોષ્ટકમાં બતાવેલ એક કમ્પાઇલ-ટાઇમ ગોઠવણી છે.

કોષ્ટક - USB ઉપકરણ CDC ACM રૂપરેખાંકન વ્યાખ્યાયિત કરો

 
રૂપરેખાંકન નામ વર્ણન ડિફૉલ્ટ મૂલ્ય
SL_USBD_CDC_ACM_SUBCLASS_INSTANCE_QUANTITY Configures the number of subclass instances you will allocate via a call to the function sl_usbd_cdc_acm_create_instance(). 2

USB ઉપકરણ CDC ACM વર્ગ ઇન્સ્ટન્સ રૂપરેખાંકનો
This section defines the configurations related to the CDC ACM serial class instances.

  • ક્લાસ ઇન્સ્ટન્સ બનાવટ
    • line state interval
    • call mgmt capabilities
    • p_acm_કોલબેક

ક્લાસ ઇન્સ્ટન્સ બનાવટ

To create a CDC ACM serial class instance, call the function sl_usbd_cdc_acm_create_instance(). This function takes three configuration arguments, as described here.

  • line_state_interval

This is the interval (in milliseconds) that your CDC ACM serial class instance will report the line state notifications to the host. This value must be a power of two (1, 2, 4, 8, 16, etc).

  • call_mgmt_capabilities

કોલ મેનેજમેન્ટ ક્ષમતાઓ બીટમેપ. બીટમેપના શક્ય મૂલ્યો નીચે મુજબ છે:

 
મૂલ્ય (બીટ) વર્ણન
SL_USBD_ACM_SERIAL_CALL_MGMT_DEV Device handles call management itself.
SL_USBD_ACM_SERIAL_CALL_MGMT_DATA_CCI_DCI Device can send/receive call management information over a Data Class interface.

p_acm_callbacks

  • p_acm_callbacks is a pointer to a structure of type sl_usbd_cdc_acm_callbacks_t. Its purpose is to give the CDC ACM Class a set of callback functions to be called when a CDC ACM event occurs.
  • Not all callbacks are mandatory and a null pointer (NULL) can be passed in the callbacks structure variable when the callback is not needed.
  • નીચે આપેલ કોષ્ટક આ રૂપરેખાંકન માળખામાં ઉપલબ્ધ દરેક રૂપરેખાંકન ક્ષેત્રનું વર્ણન કરે છે.

Table – sl_usbd_cdc_acm_callbacks_t Configuration Structure

 
ક્ષેત્રો વર્ણન કાર્ય સહી
.સક્ષમ કરો જ્યારે USB ક્લાસ ઇન્સ્ટન્સ સફળતાપૂર્વક સક્ષમ થાય ત્યારે કૉલ કરવામાં આવે છે. રદબાતલ એપ્લિકેશન_યુએસબીડી_સીડીસી_એસીએમ_સક્ષમ (યુઆઇટી8_ટી સબક્લાસ_એનબીઆર);
.અક્ષમ કરો જ્યારે USB ક્લાસ ઇન્સ્ટન્સ અક્ષમ હોય ત્યારે કૉલ કરવામાં આવે છે. રદબાતલ એપ્લિકેશન_યુએસબીડી_સીડીસી_એસીએમ_ડિઝેબલ (યુઆઇટી8_ટી સબક્લાસ_એનબીઆર);
.line_control_changed Called when a line control change is received. void app_usbd_cdc_acm_line_control_changed(uint8_t subclass_nbr, uint8_t event, uint8_t event_chngd);
line_coding_changed Called when a line coding change is received. bool app_usbd_cdc_acm_line_coding_changed(uint8_t subclass_nbr, subclass_nbr, sl_usbd_cdc_acm_line_coding_t *p_line_coding

See section Registering Event Notification Callbacks for callback functions example

USB ઉપકરણ CDC ACM વર્ગ પ્રોગ્રામિંગ માર્ગદર્શિકા
This section explains how to use the CDC Abstract Control Model class.

  • USB ઉપકરણ CDC ACM વર્ગ શરૂ કરી રહ્યા છીએ
  • તમારા ઉપકરણમાં USB ઉપકરણ CDC ACM ક્લાસ ઇન્સ્ટન્સ ઉમેરવું
  • સીડીસી એસીએમ ક્લાસનો ઉપયોગ કરીને વાતચીત કરવી

USB ઉપકરણ CDC ACM વર્ગ શરૂ કરી રહ્યા છીએ

  • To add CDC ACM class functionality to your device, you must first initialize the CDC base class and the ACM subclass by calling the functions sl_usbd_cdc_init() અને sl_usbd_cdc_acm_init().
  • માજીample below shows how to call sl_usbd_cdc_init() અને sl_usbd_cdc_acm_init() using default arguments.

Example – CDC ACM વર્ગની શરૂઆત

SILICON-LABS-Programming-USB-Device-Module-FIG- (14)

તમારા ઉપકરણમાં USB ઉપકરણ CDC ACM ક્લાસ ઇન્સ્ટન્સ ઉમેરવું
તમારા ઉપકરણમાં CDC ACM વર્ગ કાર્યક્ષમતા ઉમેરવા માટે, તમારે એક ઉદાહરણ બનાવવું પડશે, અને પછી તેને તમારા ઉપકરણના રૂપરેખાંકન(ઓ)માં ઉમેરવું પડશે.

  • સીડીસી એસીએમ ક્લાસ ઇન્સ્ટન્સ બનાવવું
  • તમારા ઉપકરણના રૂપરેખાંકન(ઓ)માં CDC ACM ક્લાસ ઇન્સ્ટન્સ ઉમેરવું
  • ઇવેન્ટ સૂચના કૉલબેક્સની નોંધણી

સીડીસી એસીએમ ક્લાસ ઇન્સ્ટન્સ બનાવવું

  • Create a CDC ACM class instance by calling the function sl_usbd_cdc_acm_create_instance().
  • માજીample below shows how to create a CDC ACM class instance via sl_usbd_cdc_acm_create_instance().

Exampલે - Creating a CDC ACM Function via sl_usbd_cdc_acm_create_instance()

SILICON-LABS-Programming-USB-Device-Module-FIG- (18)

તમારા ઉપકરણના રૂપરેખાંકન(ઓ)માં CDC ACM ક્લાસ ઇન્સ્ટન્સ ઉમેરવું

  • CDC ACM ક્લાસ ઇન્સ્ટન્સ બનાવ્યા પછી, તમે ફંક્શનને કૉલ કરીને તેને ગોઠવણીમાં ઉમેરી શકો છો sl_usbd_cdc_acm_add_to_configuration().
  • માજીample below shows how to call sl_usbd_cdc_acm_add_to_configuration().

Example – Call to USBD ACM sl_usbd_cdc_acm_add_to_configuration()

SILICON-LABS-Programming-USB-Device-Module-FIG- (19)

  1. Class number to add to the configuration returned by sl_usbd_cdc_acm_create_instance().
  2. Configuration number (here adding it to a Full-Speed configuration).

ઇવેન્ટ સૂચના કૉલબેક્સની નોંધણી

The CDC ACM Serial class can notify your application of any changes in line control or coding via notification callback functions. A callback functions structure can be passed as argument during the ACM instance creation. Note that those callbacks are optional. Example – CDC ACM Callbacks Registration illustrates the use of the callback registration functions. Example – CDC ACM Callbacks Implementation shows an exampકોલબેક ફંક્શન્સના અમલીકરણનો સમયગાળો.

Example – CDC ACM કોલબેક્સ નોંધણીSILICON-LABS-Programming-USB-Device-Module-FIG- (20)

Example – CDC ACM કોલબેક્સ અમલીકરણ

SILICON-LABS-Programming-USB-Device-Module-FIG- (21)

  1. It is important to return false to this function if the line coding applying failed. Otherwise, return true.

સીડીસી એસીએમ ક્લાસનો ઉપયોગ કરીને વાતચીત કરવી

  • સીરીયલ સ્ટેટસ
    • લાઇન કોડિંગ
    • રેખા નિયંત્રણ
    • રેખા રાજ્ય
  • સબક્લાસ ઇન્સ્ટન્સ કોમ્યુનિકેશન

સીરીયલ સ્ટેટસ

લાઇન કોડિંગ

  • The USB host controls the line coding (baud rate, parity, etc) of the CDC ACM device. When necessary, the application is responsible for setting the line coding.
  • There are two functions provided to retrieve and set the current line coding, as described in the table below.

કોષ્ટક - સીડીસી એસીએમ લાઇન કોડિંગ કાર્યો

 
કાર્ય વર્ણન
sl_usbd_cdc_acm_get_line_coding() Your application can get the current line coding settings set either from the host with SetLineCoding requests or with the function sl_usbd_cdc_acm_set_line_coding().
sl_usbd_cdc_acm_set_line_coding() તમારી એપ્લિકેશન લાઇન કોડિંગ સેટ કરી શકે છે. હોસ્ટ GetLineCoding વિનંતી સાથે સેટિંગ્સ પુનઃપ્રાપ્ત કરી શકે છે.

રેખા નિયંત્રણ

  • The USB host controls the line control (RTS and DTR pins, break signal, and so on) of the CDC ACM device. When necessary, your application is responsible for applying the line controls.
  • A function is provided to retrieve and set the current line controls, as are described in the table below.

કોષ્ટક - સીડીસી એસીએમ લાઇન કંટ્રોલ ફંક્શન્સ

 
કાર્ય  
sl_usbd_cdc_acm_get_line_control_state() તમારી એપ્લિકેશન SetControlLineState વિનંતી સાથે હોસ્ટ દ્વારા સેટ કરેલી વર્તમાન નિયંત્રણ રેખા સ્થિતિ મેળવી શકે છે.

રેખા રાજ્ય

  • The USB host retrieves the line state at a regular interval. Your application must update the line state each time it changes. When necessary, your application is responsible for setting the line state.
  • Two functions are provided to retrieve and set the current line controls, as described in the table below.

Table – CDC ACM Line State Functions

 
કાર્ય  
sl_usbd_cdc_acm_set_line_state_event() તમારી એપ્લિકેશન કોઈપણ લાઇન સ્ટેટ ઇવેન્ટ(ઓ) સેટ કરી શકે છે. લાઇન સ્ટેટ સેટ કરતી વખતે, સીરીયલ લાઇન સ્ટેટમાં ફેરફાર વિશે જાણ કરવા માટે હોસ્ટને એક ઇન્ટરપ્ટ IN ટ્રાન્સફર મોકલવામાં આવે છે.
sl_usbd_cdc_acm_clear_line_state_event() એપ્લિકેશન લાઇન સ્ટેટની બે ઇવેન્ટ્સને ક્લિયર કરી શકે છે: ટ્રાન્સમિશન કેરિયર અને રીસીવર કેરિયર ડિટેક્શન. બાકીની બધી ઇવેન્ટ્સ ACM સીરીયલ ઇમ્યુલેશન સબક્લાસ દ્વારા સ્વ-ક્લિયર થાય છે.

સબક્લાસ ઇન્સ્ટન્સ કોમ્યુનિકેશન
Silicon Labs’ ACM subclass offers the following functions to communicate with the host. For more details about the functions’ parameters, see the CDC ACM Subclass Functions reference.

 
કાર્યનું નામ ઓપરેશન
sl_usbd_cdc_acm_read() Receives data from host through a bulk OUT endpoint. This function is blocking.
sl_usbd_cdc_acm_write() Sends data to host through a bulk IN endpoint. This function is blocking.

Table – CDC ACM Communication API Summary

  • sl_usbd_cdc_acm_read() અને sl_usbd_cdc_acm_write() provide synchronous communication, which means that the transfer is blocking. In other words, upon calling the function, the application blocks until the transfer is complete with or without an error. A timeout can be specified to avoid waiting forever. The exampનીચે વાંચવા અને લખવાનો અનુભવ બતાવે છેample જે બલ્ક OUT એન્ડપોઇન્ટનો ઉપયોગ કરીને હોસ્ટ પાસેથી ડેટા મેળવે છે અને બલ્ક IN એન્ડપોઇન્ટનો ઉપયોગ કરીને હોસ્ટને ડેટા મોકલે છે.

લિસ્ટિંગ - સીરીયલ રીડ અને રાઈટ એક્સample

SILICON-LABS-Programming-USB-Device-Module-FIG- (26)

  1. The class instance number created with sl_usbd_cdc_acm_create_instance() provides an internal reference to the ACM subclass to route the transfer to the proper bulk OUT or IN endpoint.
  2. Your application must ensure that the buffer provided to the function is large enough to accommodate all the data. Otherwise, synchronization issues might happen.
  3. To avoid an infinite blocking situation, specify a timeout expressed in milliseconds. A value of ‘0’ makes the application task wait forever.
  4. The application provides the initialized transmit buffer.

FAQs

Q: How do I troubleshoot if my USB device is not recognized by the system?

A: Ensure that the device is properly connected, check the USB cable and port, verify drivers are up to date, and try connecting to a different USB port.

Q: Can I use multiple USB classes simultaneously on the same device?

A: Yes, you can instantiate and add multiple class instances to a configuration to create a multi-function device.

દસ્તાવેજો / સંસાધનો

PDF thumbnailProgramming USB Device Module
User Guide · Programming USB Device Module, USB Device Module, Device Module

પ્રશ્ન પૂછો

Use this section to ask about setup, compatibility, troubleshooting, or anything missing from this manual.

પ્રશ્ન પૂછો

Ask about setup, compatibility, troubleshooting, or anything missing from this manual. Name and email are optional.