Microsemi DG0476 SmartFusion2 USB OTG Capabilities User Guide

June 9, 2024
Microsemi

Microsemi-logo

Microsemi DG0476 SmartFusion2 USB OTG Capabilities

Microsemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
product

DG0476
SmartFusion2 – USB OTG Capabilities

Microsemi Headquarters
One Enterprise, Aliso Viejo,
CA 92656 USA
Within the USA: +1 800-713-4113 Outside the USA: +1 949-380-6100 Sales: +1 949-380-6136
Fax: +1 949-215-4996
Email: sales.support@microsemi.com www.microsemi.com
©2021 Microsemi, a wholly owned subsidiary of Microchip Technology Inc. All rights reserved. Microsemi and the Microsemi logo are registered trademarks of Microsemi Corporation. All other trademarks and service marks are the property of their respective owners.
Microsemi makes no warranty, representation, or guarantee regarding the information contained herein or the suitability of its products and services for any particular purpose, nor does Microsemi assume any liability whatsoever arising out of the application or use of any product or circuit. The products sold hereunder and any other products sold by Microsemi have been subject to limited testing and should not be used in conjunction with mission-critical equipment or applications. Any performance specifications are believed to be reliable but are not verified, and Buyer must conduct and complete all performance and other testing of the products, alone and together with, or installed in, any end-products. Buyer shall not rely on any data and performance specifications or parameters provided by Microsemi. It is the Buyer’s responsibility to independently determine suitability of any products and to test and verify the same. The information provided by Microsemi hereunder is provided “as is, where is” and with all faults, and the entire risk associated with such information is entirely with the Buyer. Microsemi does not grant, explicitly or implicitly, to any party any patent rights, licenses, or any other IP rights, whether with regard to such information itself or anything described by such information. Information provided in this document is proprietary to Microsemi, and Microsemi reserves the right to make any changes to the information in this document or to any products and services at any time without notice.

About Microsemi
Microsemi, a wholly owned subsidiary of Microchip Technology Inc. (Nasdaq: MCHP), offers a comprehensive portfolio of semiconductor and system solutions for aerospace & defense, communications, data center and industrial markets. Products include high-performance and radiation-hardened analog mixed-signal integrated circuits, FPGAs, SoCs and ASICs; power management products; timing and synchronization devices and precise time solutions, setting the world’s standard for time; voice processing devices; RF solutions; discrete components; enterprise storage and communication solutions, security technologies and scalable anti-tamper products; Ethernet solutions; Power- over-Ethernet ICs and midspans; as well as custom design capabilities and services. Learn more at www.microsemi.com.

Revision History

The revision history describes the changes that were implemented in the document. The changes are listed by revision, starting with the most current publication.

Revision 7.0
The following is a summary of the changes made in this revision.

  • Updated the document for Libero SoC v2021.1.
  • Removed the references to Libero version numbers.

Revision 6.0

  • Updated the document for Libero v11.7 software release (SAR 76712c).

Revision 5.0

  • Updated the document for Libero v11.6 software release (SAR 72555).

Revision 4.0

  • Updated the document for Libero v11.5 software release (SAR 64193).

Revision 3.0

  • Updated the document for Libero v11.4 software release (SAR 61626).

Revision 2.0

  • Updated the document for Libero v11.3 software release (SAR 58734).

Revision 1.0

  • Updated the document for Libero v11.2 software release (SAR 52961).

Revision 0.0

  • The first publication of this document.

Preface

Purpose
This demo is for the SmartFusion®2 System-on-Chip (SoC) Field Programmable Gate Array (FPGA) devices. It explains the Universal Serial Bus (USB) 2.0 on- the-go (OTG) feature with the help of USB mass storage class.

Intended Audience
This demo guide is intended for:

  • FPGA designers
  • Embedded designers
  • System-level designers

References
The following documents are referred in this demo guide.

  • UG0331: SmartFusion2 Microcontroller Subsystem User Guide
  • Configuring Serial Terminal Emulation Programs Tutorial
  • TU0546: SoftConsole v4.0 and Libero SoC v11.7 Tutorial

Refer to the following web page for a complete and up-to-date listing of SmartFusion2 device documentation: www.microsemi.com/products/fpga-soc/soc- fpga/sf2docs#documents.

USB OTG Capabilities of SmartFusion2

Introduction
Microsemi offers a reference design for the SmartFusion2 SoC FPGA devices that demonstrates the USB controller OTG feature and implements the USB mass storage class. The reference design runs on the SmartFusion2 Security Evaluation Kit. The SmartFusion2 SoC FPGA device contains a USB OTG controller as part of the Microcontroller Subsystem (MSS). This demo guide describes the mechanism for the USB communication between the SmartFusion2 device and the external USB host/USB device/USB OTG protocol compliant devices provided by the SmartFusion2 USB OTG controller.
OTG is the USB 2.0 mode of operation, where the USB 2.0 OTG controller works as either the USB host or the USB device based on the target device and type of the plug connected to the USB OTG controller. For more information about the USB OTG controller and its operations, refer to UG0331: SmartFusion2 Microcontroller Subsystem User Guide..

Design Requirements
Table 1 lists the hardware and software design requirements for running this demo design.Microsemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
fig-1

Note: Libero SmartDesign and configuration screen shots shown in this guide are for illustration purpose only. Open the Libero design to see the latest updates.

Prerequisites
Before you begin:
Download and install Libero SoC (as indicated in the website for this design) on the host PC from the following location.
https://www.microsemi.com/product-directory/design-resources/1750-libero-soc

Demo Design
Introduction
The demo design files are available for download from the following path in the Microsemi website: http://soc.microsemi.com/download/rsc/?f=m2s_dg0476_df
The demo design files include:

  • Libero_Project
  • USB drivers
  • Programming_Job
  • Readme file

Figure 1 shows the top-level structure of the design files. For more details, refer to the readme.txt file.
Figure 1 • Demo Design Files Top-Level Structure Figure 2 shows the demo architecture.
Figure 2 • Top-Level Block DiagramMicrosemi-DG0476-SmartFusion2-USB-OTG-
Capabilities-fig-3 Note : MSS USB drivers are provided along with the design files. These drivers are customized and used in the demo.

Demo Design Features
The main objective of the demo is to show OTG capability with USB mass storage class. The demo design performs the following operations:

  • Switching the USB OTG controller operation between Host mode and Device mode based on the target device and type of plug connected to the USB OTG controller.
  • Device mode operation:
  • Displaying the on-board SPI flash (8 MB) as a storage medium in the host PC.
  • Host mode operation:
  • Detecting the USB 2.0 complaint USB mass storage device connected to the USB OTG controller and listing the file names.

Demo Design Description
The USB OTG controller in the SmartFusion2 device can be configured to operate in the USB device mode/USB host mode/USB OTG mode. In USB OTG mode, the USB OTG controller acts as either a USB device or USB host based on the target device and type of plug connected to the USB OTG controller.
If the Micro-A end of the cable is plugged into the SmartFusion2 device through the external PHY, the USB controller takes the role of the host and goes into the Host mode. The Host mode flag is set to 1.
If the Micro-B end of the cable is plugged in, the USB controller goes into the Peripheral mode, and the Host mode flag is set to 0.
The demo design application initializes the USB Host mode stack and USB Device mode stack to operate in the USB OTG mode. When the USB OTG controller enters into the Device mode, the application initializes the USB mass storage class and registers with the MSS USB Device mode driver. The on-board SPI flash memory (8 MB) is used as a storage medium in the USB Device mode operation, and read/write operations can be performed. When the USB OTG controller enters into the Host mode, the application registers the USB mass storage class with the MSS USB Host mode driver. The application detects the connected mass storage device and lists the files names. The application uses the FatFs file system library to access the files from the target USB mass storage device. For more information about the FatFs file system, refer to http://elm- chan.org/fsw/ff/00index_e.html.

USB OTG Mode Execution Flow
Figure 3 describes the USB OTG mode execution flow.
Figure 3 • USB OTG Execution FlowMicrosemi-DG0476-SmartFusion2-USB-OTG-
Capabilities-fig-4

  • The demo application configures MMUART_1 for serial communication, SPI_0 to access SPI-Flash, and GPIO to keep the USB controller out of reset. The application registers the USB callback functions and USB interrupt service routine to handle the USB events like connect/disconnect, Host mode specific events, and Device mode specific events.
  • When the SmartFusion2 device is connected to the host PC with Micro-B to A USB cable, the USB connect interrupt is generated and the Host mode flag is set to 0. The USB controller enters into mass storage class device mode and starts responding to the commands from the host PC. The SmartFusion2 on-board SPI-Flash is accessed by the host PC as a disk drive/volume in the USB Device mode.
  • When the Micro-A to B receptacle USB cable with the USB mass storage device is connected to the SmartFusion2 device, the connect interrupt is generated and the Host mode flag is set to 1. The USB controller switches to the Host mode from the Device mode and accesses the USB mass storage device.
  • When the USB mass storage device is unplugged from the SmartFusion2 device, the Host mode flag is set to 0 and the disconnect interrupt is generated. The application releases the Host mode driver and waits to enter into either the Device mode or Host mode based on the target device and type of plug connected to the USB controller.

Setting Up the Demo Design
The following steps describe how to setup the demo design:

  1. Connect the FlashPro4 programmer to the J5 connector of the SmartFusion2 Security Evaluation Kit board.

  2. Connect the host PC to the J18 connector on the SmartFusion2 Security Evaluation Kit board using the USB A to Mini-B cable.

  3. Ensure that the USB to UART bridge drivers are automatically detected. Download and install the drivers from www.microsemi.com/soc/documents/CDM_2.08.24_WHQL_Certified.zip.

  4. Of the four COM ports, select the one with Location as on USD Serial Converter D. Figure 4 shows an example of the Device Manager window that has the USB Serial Port and its properties showing the port number and location. The COM port number is required to run the demo design, make a note of it.
    Figure 4 • USB to UART Bridge DriversMicrosemi-DG0476-SmartFusion2-USB-
OTG-Capabilities-fig-5

  5. Connect the jumpers on the SmartFusion2 Security Evaluation Kit board, as shown in Table 2. For more information about jumper locations, refer to Appendix 4: Jumper Locations, page 16.
    CAUTION: Switch OFF the power supply switch, SW7, before connecting the jumpers.
    Table 2 • SmartFusion2 Security Evaluation Kit Jumper SettingsMicrosemi-
DG0476-SmartFusion2-USB-OTG-Capabilities-fig-6

  6. Connect the power supply to the J6 DC jack.

Board Setup
Snapshots of the SmartFusion2 Security Evaluation Kit board with the complete setup for both types of connections are given in the following sections:

  • Appendix 2: Board Setup for USB OTG Controller in USB Device Mode, page 14
  • Appendix 3: Board Setup for USB OTG Controller in USB Host Mode, page 15

Running the Demo Design
The following steps describe how to run the demo design:

  1. Download the demo design from:
    http://soc.microsemi.com/download/rsc/?f=m2s_dg0476_df

  2. Switch ON the power supply switch, SW7.

  3. Start any serial terminal emulation program such as:

    • HyperTerminal

    • PuTTY

    • TeraTerm
      The configuration for the program is:

    • Baud Rate: 115200

    • 8 Data bits

    • 1 Stop bit

    • No Parity

    • No Flow Control
      For more information about configuring the serial terminal emulation programs, refer to Configuring Serial Terminal Emulation Programs Tutorial.

  4. Program the SmartFusion2 Security Evaluation Kit board with the job file provided as part of the design files using FlashPro Express software, refer to Appendix 1: Programming the Device Using FlashPro Express, page 11.

  5. After successfully programming the SmartFusion2 device using FlashPro Express, the serial terminal emulation program shows the initialization messages, as shown in Figure 5. The SmartFusion2 USB OTG controller is now set to perform the USB OTG functionality.
    Figure 5 • UART MessageMicrosemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
fig-7

SmartFusion2 USB OTG Controller Acting as USB Device
The following steps describe how to use the SmartFusion2 USB OTG Controller as a USB device:

  1. Connect the host PC to the micro AB receptacle (P1 connector) on the SmartFusion2 Security Evaluation Kit board using the Micro-B to A USB cable.
    A new disk drive/volume is created in the host PC.

  2. Right-click the drive and select properties, as shown in Figure 6 to verify the USB device functionality of the SmartFusion2 USB OTG controller.
    Note: Format the disk drive when prompted by the host PC and ensure that there is no important data on the SmartFusion2 Security Evaluation Kit on- board SPI-Flash.
    Figure 6 • SmartFusion2 USB Device Detection on Host PC/LaptopMicrosemi-
DG0476-SmartFusion2-USB-OTG-Capabilities-fig-8

SmartFusion2 USB OTG Controller Acting as USB Host
The following steps describe how to use the SmartFusion2 USB OTG Controller as a USB host:

  1. Unplug the Micro-B to A USB cable from the P1 connector of the SmartFusion2 Security Evaluation Kit board.
  2. Insert the Micro-A to B USB cable with a USB mass storage device at the B type end of the cable, as shown in Figure 7. Ensure that the mass storage device is preformatted.
  3. Connect the Micro-A end of the Micro-A to B USB cable to the P1 connector of the SmartFusion2 Security Evaluation Kit board.
    The SmartFusion2 USB OTG controller switches to the USB Host mode and detects the connected USB mass storage device to perform transactions as the USB host. The application enumerates the USB mass storage device and reads all file names on the USB drive to display the list on the serial terminal emulation program, as shown in Figure 8.
    Microsemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
fig-9Figure 8 • USB Host Mode ResultsMicrosemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
fig-10To verify the USB OTG functionality again repeat the process of the SmartFusion2 USB OTG controller acting as a USB device and USB host.

Appendix 1: Programming the Device Using FlashPro Express

This section describes how to program the SmartFusion2 device with the programming job file using FlashPro Express.
To program the device, perform the following steps:

  1. Ensure that the jumper settings on the board are the same as those listed in Table 2, page 8.
    Note: The power supply switch must be switched off while making the jumper connections.

  2. Connect the power supply cable to the J6 connector on the board.

  3. Power ON the power supply switch SW7.

  4. On the host PC, launch the FlashPro Express software.

  5. Click New or select New Job Project from FlashPro Express Job from Project menu to create a new job project, as shown in Figure 9.
    Figure 9 • FlashPro Express Job ProjectMicrosemi-DG0476-SmartFusion2-USB-
OTG-Capabilities-fig-11

  6. Enter the following in the New Job Project from FlashPro Express Job dialog box:

    • Programming job file: Click Browse, and navigate to the location where the .job file is located and select the file. The default location is:

      \m2s_dg0476_df\Programming_Job
    • FlashPro Express job project name: Click Browse and navigate to the location where you want to save the project.
      Figure 10 • New Job Project from FlashPro Express JobMicrosemi-
DG0476-SmartFusion2-USB-OTG-Capabilities-fig-12

  7. Click OK. The required programming file is selected and ready to be programmed in the device.

  8. The FlashPro Express window appears as shown in Figure 11. Confirm that a programmer number appears in the Programmer field. If it does not, confirm the board connections and click
    Refresh/Rescan Programmers.
    Figure 11 • Programming the DeviceMicrosemi-DG0476-SmartFusion2-USB-OTG-
Capabilities-fig-13

  9. Click RUN. When the device is programmed successfully, a RUN PASSED status is displayed as shown in Figure 12.
    Figure 12 • FlashPro Express—RUN PASSEDMicrosemi-DG0476-SmartFusion2-USB-
OTG-Capabilities-fig-14

  10. Close FlashPro Express or in the Project tab, click Exit.

Appendix 2: Board Setup for USB OTG Controller in USB Device Mode

Figure 13 shows the board setup for USB OTG Controller in USB Device Mode.
Figure 13 • Setup for USB OTG Controller in USB Device ModeMicrosemi-
DG0476-SmartFusion2-USB-OTG-Capabilities-fig-15

Appendix 3: Board Setup for USB OTG Controller in USB Host Mode

Figure 14 shows the board setup for USB OTG Controller in USB Host Mode.
Figure 14 • Setup for USB OTG Controller in USB Host ModeMicrosemi-
DG0476-SmartFusion2-USB-OTG-Capabilities-fig-16

Appendix 4: Jumper Locations

Figure 15 shows the jumper locations in the SmartFusion2 Security Evaluation Kit board.
Figure 15 • SmartFusion2 Security Evaluation Kit Silkscreen Top View Microsemi-DG0476-SmartFusion2-USB-OTG-Capabilities-
fig-17

Note:

  • Jumpers highlighted in red (J22, J23, J8, J3) are set as default.
  • Jumpers highlighted in green (J24) need to be set manually.
  • The locations of the jumpers in Figure 15 are searchable.

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals