Synergy Software Package User's Manual
USBX Port

USBX Synergy Port Framework Introduction

The Azure RTOS USBX Synergy Port framework module (sf_el_ux) is integrated into the SSP and is used with Azure RTOS USBX. For more information about USBX (including API references), refer to the USBX User Guide.

Unsupported Features

The following features have not been integrated into this version of SSP:

  • USBX  host class asix
  • USBX  host class audio
  • USBX  host class gser
  • USBX  host class dpump
  • USBX  device class cdc-ecm 
  • USBX device class rndis
  • USBX device class DFU
  • USBX device class DPUMP
  • USBX OTG host and device class

The following features are experimental. They have been integrated but not tested:

  • USBX PIMA device class
  • USBX Pictbridge device implementation

USBX Synergy Port Framework Module Features

The Azure RTOS USBX Synergy Port Framework module supports the following features:

  • Implements Azure RTOS USBX in SSP- supports USBX APIs
  • Supports the Port Device Controller Driver (DCD) for the USBHS peripheral
  • Supports the Port Device Controller Driver (DCD) for the USBFS peripheral
  • Supports the Port Host Controller Driver (HCD) for the USBHS peripheral
  • Supports the Port Host Controller Driver (HCD) for the USBFS peripheral
  • Supports manual switch over between host & device USB stack on same USB(ie USBHS or USBFS) port.
  • Supports transfer module operation (optional)
sf_el_ux_BD.png
USBX Synergy Port Framework Module Block Diagram

__*

Note
Currently, the r_dtc is not supported for both the host side driver and device side driver (only r_dmac is supported).***

USBX Synergy Port Framework Module APIs Overview

The Azure RTOS USBX Synergy Port Framework module doesn't have API calls of its own- it implements the API calls for the Azure RTOS USBX API calls. Documentation on these APIs is available in the Azure RTOS USBX User Manual.

USBX Synergy Port Framework Module Operational Overview

The Azure RTOS USBX Synergy Port framework module provides the Synergy USB hardware port functions required to use the USBX stack on Synergy hardware. Application code using this module is expected to use USBX API calls.

USBX Synergy Port Framework Module Important Operational Notes and Limitations

USBX Synergy Port Framework Module Operational Notes

The Azure RTOS USBX Synergy Port framework module includes the support for the Azure RTOS USBX APIs in SSP. Refer to the Azure RTOS USBX User Manual for a complete description of the available APIs.

The Azure RTOS USBX Synergy Port framework module supports the Port Device Controller Driver (DCD) on USBHS and USBFS peripherals as well as the Port Host Controller Driver (HCD) for the USBHS on USBFS peripherals.

Users have the option of using the Transfer Module for the USBX Synergy Port framework module to get better USB data throughput by transferring data in the block transfer mode. To enable the Transfer module, just add two instances of transfer components to the USBX Class stack in the Synergy Configuration tool and enable the interrupts in the property. The Synergy Configuration tool auto-generates the driver setup code to enable DMAC or DTC transfer in common_data.c.

Note
Currently, DTC is not supported by the host side driver (only DMAC is supported).

The module uses the interrupt of a USB Controller. Set the appropriate interrupt priority level in the Synergy Configuration tool; otherwise it does not work. The module uses the interrupt of a transfer module (implemented as DMAC or DTC) if it is used. Set the appropriate priority level in the Synergy Configuration tool. The priority level of the transfer module must be higher than the priority level for the USB Controller; otherwise it does not work.

USBX Synergy Port Framework Module Limitations

  • Synergy USB controllers (USBHS and USBFS) have a limited number of PIPEs you can use for the isochronous transfer type (PIPE1 and PIPE2). This will limit the number of UVC devices (two devices) you can connect to the Synergy board configured as UVC HOST.
  • The device side driver (sf_el_ux DCD driver) does not support DTC as the transfer interface.
  • The host side driver (sf_el_ux HCD driver) does not support DTC as the transfer interface.
  • The isochronous transfer is only supported for USB Host. The transfer type is not supported for USB Device.
  • The USBFS controller is unlikely to support typical UVC devices. The maximum packet size of isochronous PIPEs on USBFS controller is limited to 256 bytes. This would impact in the UVC usage.
  • Synergy USB controllers (USBHS and USBFS) do not support high-bandwidth isochronous transfer. The controllers support 1 transaction per micro-frame if running at high-speed).
  • Refer to the most recent SSP Release Notes for any additional operational limitations for this module.

Including the USBX Synergy Port Framework Module in an Application

This section describes how to include the USBX Synergy Port Framework module in an application using the SSP configurator.

Note
It is assumed you are familiar with creating a project, adding threads, adding a stack to a thread and configuring a block within the stack. If you are unfamiliar with any of these items, refer to the first few chapters of the SSP User's Manual to learn how to manage each of these important steps in creating SSP-based applications.

To add the USBX Synergy Port Framework module to an application, simply add it to a thread using the stacks selection sequence given in the following table.

USBX Synergy Port Framework Module Selection Sequence

Resource ISDE Tab Stacks Selection Sequence
g_sf_el_ux_hcd_hs_0 USBX Port HCD on sf_el_ux for USBHS Threads New Stack> X-Ware> USBX> Host > Synergy Port> USBX Port HCD on sf_el_ux for USBHS
g_sf_el_ux_hcd_fs_0 USBX Port HCD on sf_el_ux for USBFS Threads New Stack> X-Ware> USBX> Host > Synergy Port> USBX Port HCD on sf_el_ux for USBFS
g_sf_el_ux_dcd_hs_0 USBX Port HCD on sf_el_ux for USBHS Threads New Stack> X-Ware> USBX> Device > Synergy Port> USBX Port HCD on sf_el_ux for USBHS
g_sf_el_ux_dcd_fs_0 USBX Port HCD on sf_el_ux for USBFS Threads New Stack> X-Ware> USBX> Device > Synergy Port> USBX Port HCD on sf_el_ux for USBFS

When the USBX Synergy Port Framework module is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower‑level modules. Any modules needing additional configuration information have the box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Modules with a Blue band are shared or common; they need only be added once and can be used by multiple stacks. Modules with a Pink band can require the selection of lower-level modules; these are either optional or recommended. (This is indicated in the block with the inclusion of this text.) If the addition of lower-level modules is required, the module description include Add in the text. Clicking on any Pink banded modules brings up the New icon and displays possible choices.

 

sf_el_ux_MS.png
USBX Synergy Port Framework Module Stack

Configuring the USBX Synergy Port Framework Module

The USBX Synergy Port Framework module must be configured by the user for the desired operation. The SSP configuration window automatically identifies (by highlighting the block in red) any required configuration selections, such as interrupts or operating modes, which must be configured for lower-level modules for successful operation. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and not available for changes and are identified with a lock icon for the locked property in the Properties window in the ISDE. This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the Properties tab within the SSP Configurator and are shown in the following tables for easy reference.

Note
You may want to open your ISDE, create the module and explore the property settings in parallel with looking over the following configuration table values. This helps to orient you and can be a useful hands-on approach to learning the ins and outs of developing with SSP.

Configuration Settings for the USBX Port DCD on sf_el_ux for USBFS

ISDE Property Value Description
Full Speed Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the interrupt priority for full-speed USB.
LDO Regulator (Only for S3 and S1 part MCUs) Enable, Disable

Default: Disable
Select the LDO regulator will be enabled.
Name g_sf_el_ux_dcd_fs_0 Module name.
USB Controller Selection USBFS Select the USB controller.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.

Configuration Settings for the USBX Port DCD on sf_el_ux for USBHS

ISDE Property Value Description
High Speed Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the interrupt priority for high speed USB.
Name g_sf_el_ux_dcd_hs_0 Module name.
USB Controller Selection USBHS Select the USB controller.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.

Configuration Settings for the USBX Port HCD on sf_el_ux for USBFS

ISDE Property Value Description
Full Speed Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the interrupt priority for full-speed USB.
VBUSEN pin Signal Logic Active Low, Active High

Default: Active High
Select the VBUSEN pin signal logic.
LDO Regulator (Only for S3 and S1 part MCUs) Enable, Disable

Default: Disable
Select the LDO regulator will be enabled.
Name g_sf_el_ux_hcd_fs_0 Module name.
USB Controller Selection USBFS Select the USB controller.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.

Configuration Settings for the USBX Port HCD on sf_el_ux for USBHS

ISDE Property Value Description
High Speed Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the interrupt priority for high speed USB.
FIFO size for Bulk/Isochronous Pipes 512, 1024, 1536, 2048 bytes

Default: 512 bytes
Select the FIFO size for bulk and isochronous transfers.
Number of Isochronous Pipes Reserved 0,1,2

Default: 0
Select the number of isochronous pipes to reserve.
VBUSEN pin Signal Logic Active Low, Active High

Default: Active High
Select the VBUSEN pin signal logic.
Enable High Speed Enable, Disable

Default: Enable
Select if high speed should be enabled.
Name g_sf_el_ux_hcd_hs_0 Module name.
USB Controller Selection USBHS Select the USB controller.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.
Most of the property settings for lower-level modules are intuitive and usually can be determined by inspection of the associated properties window from the SSP configurator.

Configuration Settings for the USBX Synergy Port Framework Lower-Level Modules

Only a small number of settings must be modified from the default for the IP layer and lower-level drivers as indicated via the red text in the thread stack block. Notice that some of the configuration properties must be set to a certain value for proper framework operation and are locked to prevent user modification. The following table identifies all the settings within the properties section for the module:

Configuration Settings for the Transfer Driver on r_dmac

ISDE Property Value Description
Parameter Checking BSP, Enabled, Disabled

Default: BSP
If selected code for parameter checking is included in the build.
Name g_transfer0 Module name.
Channel 0 Specify the hardware channel.
Mode Block Select the transfer mode.
Transfer Size 1 Byte Select the transfer size.
Destination Address Mode Fixed Select the address mode for the destination.
Source Address Mode Incremented Select the address mode for the source.
Repeat Area (Unused in Normal Mode Source Select the repeat area. Either the source or destination address resets to its initial value after completing Number of Transfers in Repeat or Block mode.
Destination Pointer NULL Specify the transfer destination pointer.
Source Pointer NULL Specify the transfer source pointer.
Number of Transfers 0 Specify the number of transfers.
Number of Blocks (Valid only in Block Mode) 0 Specify the number of blocks to transfer in Repeat or Block mode.
Activation Source Device: Event USBFS FIFO 0
Host: Software Activation
Select the DMAC transfer start event.
Auto Enable False Auto enable the transfer in open().
Callback NULL A user callback that is called at the end of the transfer.
Transfer End Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the transfer end interrupt priority.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.

Configuration Settings for the Transfer Driver on r_dmac

ISDE Property Value Description
Parameter Checking BSP, Enabled, Disabled

Default: BSP
If selected code for parameter checking is included in the build.
Name g_transfer0 Module name.
Channel 0 Specify the hardware channel.
Mode Block Select the transfer mode.
Transfer Size 1 Byte Select the transfer size.
Destination Address Mode Incremented Select the address mode for the destination.
Source Address Mode Fixed Select the address mode for the source.
Repeat Area (Unused in Normal Mode Destination Select the repeat area. Either the source or destination address resets to its initial value after completing Number of Transfers in Repeat or Block mode.
Destination Pointer NULL Specify the transfer destination pointer.
Source Pointer NULL Specify the transfer source pointer.
Number of Transfers 0 Specify the number of transfers.
Number of Blocks (Valid only in Block Mode) 0 Specify the number of blocks to transfer in Repeat or Block mode.
Activation Source Device: Event USBFS FIFO 1
Host: Software Activation
Select the DMAC transfer start event.
Auto Enable False Auto enable the transfer in open().
Callback NULL A user callback that is called at the end of the transfer.
Transfer End Interrupt Priority Priority 0 (highest), Priority 1:14, Priority 15 (lowest - not valid if using ThreadX), Disabled

Default: Disabled
Select the transfer end interrupt priority.
Note
The example settings and defaults are for a project using the S7G2 Synergy MCU Group. Other MCUs may have different default values and available configuration settings.

 

USBX Synergy Port Framework Module Clock Configuration

The USB peripheral module uses the UCLK as its clock source; the UCLK should be configured for 48MHz operation. In the SSP configuration window, select the Clocks tab to view the clock-source setting.

USBX Synergy Port Framework Module Pin Configuration

The USB peripheral module uses MCU pins to communicate with external devices. Select I/O pins and configure to the external device requirements. The following table illustrates the pin selection method within the SSP Configuration Window and the subsequent tables demonstrates the selection process using USB pins as an example.

Note
The selected operation mode determines what peripheral signals are available and what MCU pins are required.

USBFS and USBHS Pin Selection Sequence

Resource ISDE Tab Pin selection Sequence
USBFS Pins Select Peripherals > Connectivity: USBFS> USBFS0
USBHS Pins Select Peripherals > Connectivity: USBHS> USBHS0
Note
The selection sequence assumes USBFS0 or USBHS0 is the desired hardware target for the driver.

USBHS Pin Configuration Settings

Property Value Description
Operation Mode Disabled, Custom, Device, Host, OTG

Default: Custom
Select device as the Operation Mode
USBDP USBDP USBDP pin
USBDM USBDM USBDM pin
OVRCURB None OVRCURB pin
OVRCURA None OVRCURA pin
VBUSEN None VBUSEN pin
VBUS None, P407

Default: P407
VBUS pin
EXICEN None EXICEN pin
ID None ID Pin
VCCUSB VCCUSB VCCUSB pin
VSSUSB VSSUSB VSSUSB pin
Note
The example settings are for a project using the S7G2 Synergy MCU and the SK-S7G2 Kit. Other Synergy MCUs and other Synergy Kits may have different available pin configuration settings.

USBHS Pin Configuration Settings

Property Value Description
Operation Mode Disabled, Custom, Device, Host, OTG

Default: Custom
Select Device as the Operation Mode
USBHSDP USBHSDP USBHSDP pin
USBHSDM USBHSDM USBHSDM pin
OVRCURB None OVRCURB pin
OVRCURA None OVRCURA pin
VBUSEN PB00 VBUSEN pin
VBUS PB01 VBUS pin
EXICEN None EXICEN pin
ID None ID pin
USBHSRREF USBHSRREF USBHSRREF pin
AVCCUSBHS AVCCUSBHS AVCCUSBHS pin
AVSSUSBHS AVSSUSBHS AVSSUSBHS pin
PVSSUSBHS PVSSUSBHS PVSSUSBHS pin
VCCUSBHS VCCUSBHS VCCUSBHS pin
VSS1USBHS VSS1USBHS VSS1USBHS pin
VSS2USBHS VSS2USBHS VSS2USBHS pin
Note
The example settings are for a project using the S7G2 Synergy MCU and the SK-S7G2 Kit. Other Synergy MCUs and other Synergy Kits may have different available pin configuration settings.

Using the USBX Synergy Port Framework Module in an Application

Once the Azure RTOS Synergy Port USBX framework module is added to a thread, the Azure RTOS APIs become available for use by higher-level modules. There is usually no need to use the Azure RTOS Synergy Port USBX framework module directly in application code. Refer to the Azure RTOS USBX User's Manual if you need to use the module stand-alone and need to access the associated APIs directly.

Following is the sequence of API's called successfully in a sequential order in an application for completely deleting detected USB Device class,

!( )[media/sf_el_ux_FD.png)