AN2457 How to Handle USB Suspend Mode on SAMA5x

Introduction

This application note describes the USB Suspend mode operation in the SAMA5x series of microprocessors. The document demonstrates the USB Suspend feature, and its implementation and testing in on a SAMA5D2/D3/D4 Xplained Ultra board.

References

The following items are available on http://www.microchip.com.

Type Title Lit. No.

Datasheet SAMA5D2 Device Datasheet DS60001476

Datasheet SAMA5D3 Device Datasheet 11121

Datasheet SAMA5D4 Device Datasheet 11238

User Guide SAMA5D2 Xplained Ultra User Guide 44028

User Guide SAMA5D2 Rev. B Xplained Ultra User Guide 44083

User Guide SAMA5D3 Xplained User Guide 11269

User Guide SAMA5D4 Xplained Ultra User Guide 44005

Application Note SAMA5D2 Low-Power Modes Implementation 44042

Application Note Low-power Modes on the SAMA5D3 Series 11185

Software Package SAMA5D2 Software Package –

Refer also to Linux Kernel from GitHub on: https://github.com/linux4sam/linux-at91

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 1 AN2457

Table of Contents

Introduction...... 1

References...... 1

1. USB Suspend Mode ...... 4

2. USB Ports in SAMA5Dx Devices...... 6 2.1. USB Host and Device Ports in SAMA5D2...... 6 2.2. USB Host and Device Ports in SAMA5D3 and SAMA5D4...... 7

3. USB High-Speed Device Port (UDPHS)...... 9 3.1. Description...... 9 3.2. Embedded Characteristics...... 9 3.3. UTMI Transceivers Sharing...... 10 3.4. Working with Host Port A as Device Port...... 10

4. Entering Suspend Mode from USB Device Port...... 12 4.1. USB Device Suspend...... 12

5. Exiting Suspend Mode from USB Device Port...... 14 5.1. Receiving a Host Resume...... 14 5.2. Sending an External Resume...... 14

6. USB Host High-Speed Port (UHPHS)...... 16 6.1. Embedded Characteristics...... 16 6.2. SAMA5D2 USB Host Ports...... 16 6.3. SAMA5D3 USB Host Ports...... 16 6.4. SAMA5D4 USB Host Ports...... 16 6.5. USB Port Sharing...... 16 6.6. Block Diagram...... 17

7. Types of USB Suspend...... 20

8. USB Global Suspend...... 21 8.1. USB Global Suspend in SAMA5Dx Devices...... 21

9. Suspending USB Host Ports in SAMA5Dx Devices...... 22 9.1. USB Suspend Mode Implementation in Linux Kernel...... 22

10. USB Selective Suspend Example...... 24 10.1. Hardware Setup for USB Selective Suspend...... 24 10.2. USB Selective Suspend Mode on Host Ports ...... 25

11. USB Global Suspend Example...... 33

12. Power Consumption during USB Suspend...... 34

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 2 AN2457

13. USB Host Limitations and Corrections...... 35

14. Revision History...... 36

The Microchip Web Site...... 37

Customer Change Notification Service...... 37

Customer Support...... 37

Microchip Devices Code Protection Feature...... 37

Legal Notice...... 38

Trademarks...... 38

Quality Management System Certified by DNV...... 39

Worldwide Sales and Service...... 40

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 3 AN2457

1. USB Suspend Mode According to the USB specification, in absence of bus traffic over USB in powered state for more than 3 milliseconds, all devices that are supplied power through the Universal Serial Bus (USB) must enter Suspend mode. Suspend mode reduces the use of bus power by a device when the host has no reason to communicate with it. This enables the device to enter low-power mode in order to reduce power consumption. Bus- powered devices draw current from the USB. These devices must reduce their power consumption to meet USB specifications when they are inactive. For power consumption values, refer to Section 4 of the USB Specifications datasheet (version 1.1), available on http://www.usb.org. A device in Suspend mode can resume operation when any active signal is received on its upstream port. It can resume operation from the application using an external interrupt. Selective port suspend reduces power, with most suspended devices drawing less than 500 µA, including current from pullup resistors on the bus. All devices below a suspended port are suspended. USB High Speed Device Port (UDPHS) and USB High Speed Host Port (UHPHS) in the SAMA5x series are compliant with the Universal Serial Bus (USB), revision 2.0 High Speed Device Specification and are designed to support Suspend mode when the USB bus is inactive. USB has a start of frame or keep alive packet sent periodically on the bus. This prevents an idle bus from entering Suspend mode in the absence of data. • A high-speed bus has microframes sent every 125.0 µs ±62.5 ns • A full-speed bus has a frame sent every 1.000 ms ±500 ns

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 4 AN2457

Figure 1-1. USB Device States

Movement from one state to another depends on the USB bus state or on standard requests sent through control transactions via the default endpoint (endpoint 0). The USB bus only has two states - active and suspended - based on traffic over the bus.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 5 AN2457

2. USB Ports in SAMA5Dx Devices This section classifies the available Universal Serial Bus ports and required power supply on SAMA5Dx products.

2.1 USB Host and Device Ports in SAMA5D2 SAMA5D2 devices feature three host ports (A, B, C). Host port A and Host port B support high-speed and full-speed devices as per USB 1.1 and USB 2.0 specifications. Host port A and the device port (UDPHS) share the same transceiver. Host port C is designed for HSIC (High-Speed Inter-Circuit) and supports only high-speed devices. A detailed description is given in USB Inter-chip Transceiver (SAMA5D2 only). Figure 2-1. USB Selection

Table 2-1. SAMA5D2 USB Ports

Device SAMA5D21/22/23 SAMA5D24 SAMA5D26 SAMA5D27 SAMA5D28 Package TFBGA196 TFBGA256 LFBGA289 USB 2 (2 hosts or 1 host/1 device) 3 (2 hosts/1 2 (2 hosts or 1 3 (2 hosts/1 HSIC, or 1 HSIC, or 1 host / 1 host/ 1 device/ 1 HSIC) host/1 device/ device) 1 HSIC)

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 6 AN2457

Table 2-2. SAMA5D2 Power Supplies

Name Nominal Voltage Associated Powers Range Ground VDDUTMII 3.00V-3.60V, 3.30V GNDUTMII USB device and host UTMI +interface VDDUTMIC 1.10V-1.32V, 1.20V GNDUTMII USB device and host UTMI +core VDDHSIC 1.10V-1.32V, 1.20V GNDUTMII USB High-Speed Inter-Chip

2.2 USB Host and Device Ports in SAMA5D3 and SAMA5D4 SAMA5D3 and SAMA5D4 devices feature three host ports (A, B, C). Host ports A, B and C support high- speed and full-speed devices. Host port A is also shared with the device port (UDPHS) with a separate transceiver. Table 2-3. SAMA5D3 USB Ports

Device SAMA5D3x Package TFBGA/LFBGA USB 3 (2 hosts/ 1 device or 3 hosts)

Table 2-4. SAMA5D3 Power Supplies

Name Nominal Voltage Associated Powers Range Ground VDDOSC 1.65-3.6V GNDOSC Main oscillator cell and PLL UTMI. If PLL UTMI or USB is used, the range is to be 3.0-3.6V VDDUTMIC 1.1-1.32V, 1.2V GNDUTMI USB device and host UTMI +core VDDUTMII 3.0-3.6V, 3.3V GNDUTMI USB device and host UTMI +interface

Figure 2-2. USB Selection

Other HS Transceivers Transceiver

EN_UDPHS 0 1

Other Ports PA HS HS USB Host USB HS EHCI Device FS OHCI

DMA DMA

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 7 AN2457

Table 2-5. SAMA5D4 USB Ports

Device SAMA5D4x Package TFBGA/LFBGA USB 3 (2 hosts/ 1 device or 3 hosts)

Table 2-6. SAMA5D4 Power Supplies

Name Nominal Voltage Range Associated Ground Powers VDDUTMIC 1.1-1.32V, 1.2V GNDUTMI USB device and host UTMI +core and the UTMI PLL MUST be connected to VCCCORE. VDDUTMII 3.0-3.6V, 3.3V GNDUTMI USB device and host UTMI +interface

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 8 AN2457

3. USB High-Speed Device Port (UDPHS)

3.1 Description The USB High Speed Device Port (UDPHS) is compliant with the Universal Serial Bus, High-Speed Device Specification rev 2.0. Each endpoint can be configured in one of several USB transfer types. It can be associated with one, two or three banks of a dual-port RAM used to store the current data payload. If two or three banks are used, one DPR bank is or written by the processor, while the other is read or written by the USB device peripheral. This feature is mandatory for isochronous endpoints.

3.2 Embedded Characteristics • High-speed Device • UTMI Transceiver shared between Host and Device • USB v2.0 High-speed Compliant, 480 Mbit/s • 16 Endpoints up to 1024 Bytes • Embedded 8Kbytes of Dual-port RAM for Endpoints • Suspend/Resume Logic (UTMI Command) • Up to Three Memory Banks for Endpoints (Not for Control Endpoint) Figure 3-1. SAMA5Dx USB Block Diagram

For further description of DPRAM management, endpoint configurations and handling transfer type transactions with USB V2.0 device peripheral, refer to the respective SAMA5Dx series datasheet.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 9 AN2457

3.3 UTMI Transceivers Sharing The high-speed USB host port A is shared with the high-speed USB device port and is connected to one of the UTMI transceivers.

Figure 3-2. UTMI Transceivers Sharing

The HSIC transceiver is specific to SAMA5D2. It is a high-speed host port compliant with USB 2.0 and connected to SAMA5D2x port C.

3.4 Working with Host Port A as Device Port The selection between host and device for port A is controlled by the UDPHS enable bit (EN_UDPHS) located in the UDPHS_CTRL register. If port A is driven by the USB high-speed device, the output signals are DFSDP, DFSDM, DHSDP and DHSDM. The transceiver is automatically selected for device operation once the USB high-speed device is enabled.

Name: UDPHS_CTRL

Address: 0xFC02C000

Access : Read/Write

31 30 29 28 27 26 25 24 ------23 22 21 20 19 18 17 16 ------15 14 13 12 11 10 9 8 - - - - PULLD_DIS REWAKEUP DETACH EN_UDPHS 7 6 5 4 3 2 1 0 FADDR_EN DEV_ADDR

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 10 AN2457

EN_UDPHS: UDPHS Enable 0: UDPHS is disabled (read), or this bit disables and resets the UDPHS controller (write). Switch the host to UTMI. 1: UDPHS is enabled (read), or this bit enables the UDPHS controller (write). Switch the host to UTMI.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 11 AN2457

4. Entering Suspend Mode from USB Device Port There are two different sources from which the system or port enters Suspend state: • Selective Suspend • Global Suspend SAMA5Dx devices support both modes of suspend. This is discussed in detail in later sections.

4.1 USB Device Suspend In SAMA5Dx devices, when there is no bus activity on the USB bus for more than 3 milliseconds, the DET_SUSPD signal bit in the UDPHS_INTSTA register is set. This triggers an interrupt if the corresponding bit is set in the UDPHS_IEN register and the device enters Suspend mode. In this state, bus-powered devices must drain less than 500 μA on average from the 5V VBUS and must preserve their state so that they can resume from the state where they were suspended. At this time, UDPHS device peripheral clocks can be switched off. Below is the description of UDPHS Interrupt Status and UDPHS Interrupt Enable registers for all SAMA5x series devices. Table 4-1. UDPHS Interrupt Status Register

Name: UDPHS_INTSTA

Address: 0xFC02C014

Access : Read-only

31 30 29 28 27 26 25 24

DMA_7 DMA_6 DMA_5 DMA_4 DMA_3 DMA_2 DMA_1 -

23 22 21 20 19 18 17 16

EPT_15 EPT_14 EPT_13 EPT_12 EPT_11 EPT_10 EPT_9 EPT_8

15 14 13 12 11 10 9 8

EPT_7 EPT_6 EPT_5 EPT_4 EPT_3 EPT_2 EPT_1 EPT_0

7 6 5 4 3 2 1 0

UPSTR_RES ENDOFRSM WAKE_UP ENDRESET INT_SOF MICRO_SOF DET_SUSPD SPEED

Table 4-2. UDPHS Interrupt Enable Register

Name: UDPHS_IEN

Address: 0xFC02C010

Access : Read/Write

31 30 29 28 27 26 25 24

DMA_7 DMA_6 DMA_5 DMA_4 DMA_3 DMA_2 DMA_1 -

23 22 21 20 19 18 17 16

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 12 AN2457

Name: UDPHS_IEN

Address: 0xFC02C010

Access : Read/Write

EPT_15 EPT_14 EPT_13 EPT_12 EPT_11 EPT_10 EPT_9 EPT_8

15 14 13 12 11 10 9 8

EPT_7 EPT_6 EPT_5 EPT_4 EPT_3 EPT_2 EPT_1 EPT_0

7 6 5 4 3 2 1 0

UPSTR_RES ENDOFRSM WAKE_UP ENDRESET INT_SOF MICRO_SOF DET_SUSPD -

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 13 AN2457

5. Exiting Suspend Mode from USB Device Port Devices can leave suspended state when the host wakes them up. In Suspend mode, USB can resume from two sources: • Host Resume • External Resume

5.1 Receiving a Host Resume In Suspend mode, a resume event on the USB bus line is detected asynchronously, with transceiver and clocks disabled (however, the pullup should not be removed). Once a resume is detected on the bus, the UDPHS_INTSTA.WAKE_UP signal bit is set. It may generate an interrupt if the corresponding bit in the UDPHS_IEN register is set. This interrupt may be used to wake up the core, enable main oscillators and PLL and configure clocks.

5.2 Sending an External Resume Any USB device can be woken up by active actions associated with internal functions and then cause signaling on its upstream connections to wake up or alert the rest of the system. In Suspend state, it is possible to wake up the host by sending an external resume. After entering Suspend state, the device waits for at least 5 milliseconds before sending an external resume. This enables the device to draw the required power to change its state from Suspended to Resume. The device must force a K state from 1 to 15 milliseconds to resume the host. Table 5-1. UDPHS Interrupt Status Register

Name: UDPHS_INTSTA

Address: 0xFC02C014

Access : Read-only

31 30 29 28 27 26 25 24

DMA_7 DMA_6 DMA_5 DMA_4 DMA_3 DMA_2 DMA_1 -

23 22 21 20 19 18 17 16

EPT_15 EPT_14 EPT_13 EPT_12 EPT_11 EPT_10 EPT_9 EPT_8

15 14 13 12 11 10 9 8

EPT_7 EPT_6 EPT_5 EPT_4 EPT_3 EPT_2 EPT_1 EPT_0

7 6 5 4 3 2 1 0

UPSTR_RES ENDOFRSM WAKE_UP ENDRESET INT_SOF MICRO_SOF DET_SUSPD SPEED

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 14 AN2457

Table 5-2. UDPHS Interrupt Enable Register

Name: UDPHS_IEN

Address: 0xFC02C010

Access : Read/Write

31 30 29 28 27 26 25 24

DMA_7 DMA_6 DMA_5 DMA_4 DMA_3 DMA_2 DMA_1 -

23 22 21 20 19 18 17 16

EPT_15 EPT_14 EPT_13 EPT_12 EPT_11 EPT_10 EPT_9 EPT_8

15 14 13 12 11 10 9 8

EPT_7 EPT_6 EPT_5 EPT_4 EPT_3 EPT_2 EPT_1 EPT_0

7 6 5 4 3 2 1 0

UPSTR_RES ENDOFRSM WAKE_UP ENDRESET INT_SOF MICRO_SOF DET_SUSPD -

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 15 AN2457

6. USB Host High-Speed Port (UHPHS) The USB Host High-Speed Port (UHPHS) interfaces the USB with the host application. It handles HCI protocol (Open Host Controller Interface) as well as Enhanced HCI protocol (Enhanced Host Controller Interface).

6.1 Embedded Characteristics • Compliant with Enhanced HCI Rev 1.0 Specification • Compliant with USB V2.0 High-speed Specification • Supports High-speed 480 Mbps • Compliant with Open HCI Rev 1.0 Specification • Compliant with USB V2.0 Full-speed and Low-speed Specification • Supports both Low-speed 1.5 Mbps and Full-speed 12 Mbps USB devices • Root Hub Integrated with 3 Downstream USB HS Ports • Embedded USB Transceivers • Supports Power Management

6.2 SAMA5D2 USB Host Ports • 2 Hosts (A and B) support both High Speed (EHCI) and Full Speed (OHCI) • Port A shared with USB Device (UDPHS)

6.3 SAMA5D3 USB Host Ports • 3 Hosts (A,B,C) support both High Speed (EHCI) and Full Speed (OHCI). • Port A shared with USB Device (UDPHS)

6.4 SAMA5D4 USB Host Ports • 3 Hosts (A, B, and C) support both High Speed (EHCI) and Full Speed (OHCI) • Port A shared with USB Device (UDPHS)

6.5 USB Port Sharing HFSDPs, HFSDMs, HHSDPs and HHSDMs are not controlled by any PIO controllers. The embedded USB high-speed physical transceivers are controlled by the USB host controller. One transceiver is shared with the USB high-speed device (port A). For more details, refer to Working with Host Port A as Device Port.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 16 AN2457

6.6 Block Diagram Figure 6-1. SAMA5D2 USB Architecture

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 17 AN2457

Figure 6-2. SAMA5D3 and SAMA5D4 USB Architecture

6.6.1 Block Diagram Description Access to the USB host operational registers is achieved through the AHB bus slave interface. The Open HCI host controller and Enhanced HCI host controller initialize master DMA transfers through the AHB bus master interface as follows: • Fetches the control and transfer type information from endpoint descriptor and transfer type descriptors • Accesses endpoint data from system memory • Notifies information to root hub • Depending on the speed information, the companion controllers are notified • If the device is a high-speed device, the EHCI companion gets notified, else OHCI • Accesses the HC communication area • Writes status and retires transfer descriptor USB physical transceivers are integrated in the product and driven by the root hub’s ports. The USB root hub is integrated in the USB host. Several USB downstream ports are available. The number of downstream ports can be determined by the software driver reading the root hub’s operational registers. Device connection is automatically detected by the USB host port logic. The SAMA5Dx family supports three USB ports, which must be enabled and stabilized using the required clocks. The SAMA5D2 USB ports handle OHCI- and EHCI-compatible devices and require clocks MCK, UHP48M and UHP12M respectively.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 18 AN2457

6.6.2 USB Inter-chip Transceiver (SAMA5D2 only) This section describes the HSIC feature available in SAMA5D2. The High-Speed Inter-Chip (HSIC) is a standard for USB chip-to-chip interconnect with a 2-signal (strobe, data) source synchronous serial interface using 240 MHz DDR signaling to provide only high-speed 480 Mbps data rate. External cables, connectors and hot plug & play are not supported. The HSIC interface operates at high speed, 480 Mbps, and is fully compatible with existing USB software stacks. It meets all data transfer needs through a single unified USB software stack. No transceiver UTMI clock is required.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 19 AN2457

7. Types of USB Suspend This section summarizes the types of Suspend modes supported by the SAMA5Dx family. The SAMA5Dx product family supports two types of Suspend mode: • Global Suspend • Selective Suspend These modes are discussed in detail in the following sections.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 20 AN2457

8. USB Global Suspend USB Global Suspend enables an entire USB network of devices to enter Suspend state. This provides minimum power consumption over USB. When a system detects no activity for a period of time, the system enters a low-power state and stops sending Start-of-Frame packets on the bus. When a full- or high-speed device detects that no Start-of- Frame packet has arrived for 3 milliseconds, it enters Suspend state. Low-speed devices do the same when they have not received a low-speed keep-alive signal for 3 milliseconds. When devices enter Suspend state, they must preserve their state and consume no more than 500 microamperes of current.

8.1 USB Global Suspend in SAMA5Dx Devices Global Suspend is initiated when all the downstream traffic from the root hub is terminated. This is done under software control by issuing a Global Suspend request to the root hub's control endpoint. A device entering a low-power mode is considered as Global Suspend. Once a device enters Global Suspend, the USB bus is notified about the suspend event and the devices (end device or hub) connected to all the ports are suspended. The devices' states are saved and the clocks (HSCK, FSCK, MCK, UTMII) are disabled. By default, the USB port supports Global Suspend. In this mode, the USB ports drain no more than 500 microamperes of current. Examples of how to test Global Suspend on SAMA5Dx devices are provided in later sections. Note: For more information regarding low-power modes, refer to Application Notes SAMA5D2 Low- Power Modes Implementation and Low-power Modes on the SAMA5D3 Series on www.microchip.com.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 21 AN2457

9. Suspending USB Host Ports in SAMA5Dx Devices This section explains the generic implementation of USB Suspend to handle Global and Selective Suspends in a Linux Kernel subsystem.

9.1 USB Suspend Mode Implementation in Linux Kernel This section explains how a USB device connected to a port gets enumerated, and how a USB subsystem in the Linux kernel supports runtime power management in the form of the USB Auto Suspend feature. This demonstration is based on the example of a USB optical mouse. When a USB mouse is connected to a host port, the USB bus gets notified and the mouse gets registered with the USB bus driver. Depending on its speed specification, the mouse gets registered with the USB host controller driver's EHCI-compliant controller (in our case atmel-ehci). If it is a low-speed device or a full-speed device, it gets bypassed to other available companion controllers (in our case at91-ohci). When full-speed transactions are performed, these transactions are prevented from reaching the low-speed devices that otherwise might be confused by a full-speed device transaction. The USB host acquires the information regarding the connected USB device over the hub from its endpoint 0. According to the device configuration read by the USB host from endpoint 0 (Control), it identifies its type and categorizes it (in this case as an Interrupt type). The USB mouse gets registered with the input device subsystem.

A Linux driver for a USB device informs the USB subsystem that it supports USB auto suspend. It does so by setting a flag in its usb_driver structure.

For example, the USB storage driver includes this initialization:

static struct usb_driver usb_storage_driver = {

/* ... */

.supports_autosuspend = 1,

/* supports_autosuspend: if set to 0, the USB

Core will not allow auto suspend for devices bound to this driver.*/

};

The API for implementing USB auto-suspend is based on drivers informing the core USB subsystem whenever a reason for not suspending a device arises or ceases to exist. The subsystem counts the reasons why a device must not be auto-suspended. The core USB subsystem may then suspend a device whose counter has reached zero. In Linux, the USB device may consist of a multitude of interfaces, and each one may have its own driver that manages the counter values depending on the bus activity. The counters are manipulated with "get" and "put" functions that wake or suspend devices according to the state of the counters. The function below increments the counter and guarantees that the device has been resumed.

usb_autopm_get_interface(struct usb_interface *);

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 22 AN2457

The function below decrements the counter. (This call may sleep.)

usb_autopm_put_interface(struct usb_interface *);

If the counter is zero, the device is suspended; else it is active.

void usb_enable_autosuspend(struct usb_device *)

{

pm_runtime_allow(&udev->dev);

}

For full source code implementation, refer to https://github.com/linux4sam/linux-at91

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 23 AN2457

10. USB Selective Suspend Example This section demonstrates the USB Selective Suspend mode in SAMA5Dx USB host ports, based on the example of a USB optical mouse.

10.1 Hardware Setup for USB Selective Suspend This section describes the hardware setup required to test the USB Selective Suspend feature on a SAMA5D2 Xplained Ultra board. Figure 10-1. SAMA5D2 Xplained Ultra Board

• Connect the Micro USB cable to the EDBG-USB connector (J14). • Connect the FTDI cable to the DEBUG connector (J1). • Set the baud rate. • When a USB optical mouse is connected to A5-USB-B (J13) on the SAMA5D27-XULTRA board as shown in Figure 10-1, the USB subsystem recognizes the optical mouse and enumerates it by reading the Control, Configuration and Interface information from its Endpoint 0. The mouse gets detected by the respective layers depending on its control and configuration details.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 24 AN2457

Figure 10-2. Hardware Setup

Figure 10-3. FTDI Cable Connection

10.2 USB Selective Suspend Mode on Host Ports This section describes the Selective Suspend on SAMA5Dx host ports, tested on the following ports individually: SAMA5D2: Host Port B SAMA5D3: Host Port B and Host Port C (see Note) SAMA5D4: Host Port B and Host Port C Note: SAMA5D3 Host Port C is OHCI-compliant and does not support EHCI-compliant devices. For more details, refer to the device datasheet.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 25 AN2457

10.2.1 Useful Attributes in Linux USB Subsystem • In a Linux kernel, the interface can be used to communicate with a device to read some bytes of data from the hardware and write to it. The hardware can then respond by using device attributes. • For a USB subsystem, some attributes help to suspend the USB device that is connected on a specific port on the USB bus. • When a USB device is connected on the bus and is enumerated, it creates an entry in the Sysfs hierarchy of the kernel subsystem. This entry has attributes which enable the user to control the USB device, read the vendor ID, product ID, configuration, maximum packet size, power and control information of the USB device connected on the USB port. • The following three required Sysfs attributes can be used to suspend the USB device:

root#/sys/bus/usb/$DEVICE/power/control

The above attribute can have any one of the following settings: • “on” for inactive auto suspend. This means that the device must not be auto-suspended by default. • “auto” for active auto suspend. This means that the device can be suspended when traffic over the bus is inactive.

root#/sys/bus/usb/$DEVICE/power/autosuspend

The above attribute can have any integer value. This value determines the delay (in seconds) before the USB device is suspended. • Integer values only are valid. • This value specifies that the USB device must remain active for the time specified in seconds if there is no activity on the USB bus. • Once this time has elapsed, the USB device is suspended.

root#/sys/bus/usb/$DEVICE/power/autosuspend_delay_ms

The above attribute can have any integer value. This value determines the delay (in milliseconds) before the USB device is suspended. • Integer values only are valid. • This value specifies that the USB device must remain active for the time specified in milliseconds if there is no activity on the USB bus. • Once this time has elapsed, the USB device is suspended.

10.2.2 Demo Using a USB Optical Mouse Connected to Host Port B or C (D3/D4) The steps below are applicable for all SAMA5Dx products. For testing purposes, SAMA5D2_XULTRA is used throughout this demo. • Before starting this demo, make sure that the latest software version is loaded and that the device is booting Linux. For more information, refer to: http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d2XplainedMainPage#Demo • When the Logitech USB optical mouse is connected to the SAMA5D2 Xplained Ultra board, you can observe debug messages from the kernel that explain that the USB device is detected on the USB bus and enumerated as an input device:

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 26 AN2457

• The image below shows the power attributes as Sysfs entries that relate to a USB device:

• Default value of the “control” attribute in Sysfs:

• Default value of the “autosuspend” and “autosuspend_delay_ms” attributes in Sysfs:

• When the value of the “control” attribute is set to “on”, the USB device will never be suspended. • To make sure the USB device enters Suspend state, change the value of “control” attribute to “auto”. • The user can change the default values of “autosuspend” and “autosuspend_delay_ms”, which specify the time for the USB device to enter Suspend state as explained in the above sections. • Follow the steps below to suspend the connected USB device.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 27 AN2457

• After the “control” attribute value is set to “auto”, the driver checks internally this attribute's status. It allows the device to be active for the time specified in the “autosuspend” attribute and immediately suspends the device if there is no activity over the port for the time specified (in seconds) by “autosuspend”. • As the device used in the demo (an optical mouse) is a remote wakeup enabled device, the port will resume to the state where it was before being suspended when the device asserts wakeup signal on the bus. Then, clicking the mouse button or moving the mouse resumes both the port and the device.

10.2.3 Signal Behavior on Pins USBB_DP and USBB_DM This section describes the hardware connection of the SAMA5D2 USB host port B. Figure 10-4. SAMA5D2 Host Port B

USB-B is connected to SAMA5D2 as shown in the above figure. USBB_VBUS_5V is the line from which the USB device gets powered from the USB bus. USBB_DP and USBB_DM are data lines through which the device communicates.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 28 AN2457

To observe the signal behavior on the data lines of the USB device (in our case, an optical mouse), we can probe on the USBB_DP and USBB_DM lines when the device is active (not suspended) using an oscilloscope. The figure below shows the signal levels observed. Figure 10-5. Active Signal on USBB_DP and USBB_DM

When we probe on the USBB_DP and USBB_DM lines when the device is suspended using an oscilloscope, we observe no activity on the respective lines.

10.2.4 Selective Suspend from Host Port A on SAMA5Dx This section, applicable to all SAMA5Dx products, describes Selective Suspend on host ports of the SAMA5Dx products tested individually on the ports below. In all SAMA5Dx devices Host Port A (EHCI- compliant port; for more details, refer to the device datasheet). This port is shared with the device port over the UTMI transceiver. This port is enabled as a device port by default. The selection between host port A and the USB device is controlled by the UDPHS enable bit (EN_UDPHS) located in the UDPHS_CTRL register. To use port A as host port, make sure that bit EN_UDPHS is cleared in the UDPHS_CTRL register. Table 10-1. UDPHS Control Register

Name: UDPHS_CTRL

Address: 0xFC02C000

Access : Read/Write

31 30 29 28 27 26 25 24 ------23 22 21 20 19 18 17 16 ------15 14 13 12 11 10 9 8 - - - - PULLD_DIS REWAKEUP DETACH EN_UDPHS 7 6 5 4 3 2 1 0

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 29 AN2457

EN_UDPHS: UDPHS Enable 0: UDPHS is disabled (read), or this bit disables and resets the UDPHS controller (write). Switch the host to UTMI. 1: UDPHS is enabled (read), or this bit enables the UDPHS controller (write). Switch the host to UTMI. For testing, the Gadget driver and the HID drivers can be used in order to make the device a host and to access the device connected to other host ports of the device.

10.2.5 Hardware Setup for Connecting USB Host Port to PC This section describes the hardware setup required to test the USB Selective Suspend feature on a SAMA5D2 Xplained Ultra board. Figure 10-6. SAMA5D2 Xplained Ultra Board

• Connect the Micro USB cable to the EDBG-USB connector (J14). • Connect the FTDI cable to the DEBUG connector (J1). • Set the baud rate to 115200 for an SD_MMC1 boot, or to 57600 for an eMMC boot.

The following steps are applicable to all SAMA5Dx products: • Host port A is connected to any preferred Windows or Linux PC to draw the power required to power up the SAMA5Dx_XULT boards. • By using port A from the PC, a selective suspend of the other host ports available on the device can be performed. The block diagram below shows the hardware setup required to test Selective Suspend of host ports through port A.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 30 AN2457

Figure 10-7. SAMA5Dx Device Port A

• Before starting the test, make sure that the “configfs” support in the kernel configuration is enabled. • Make sure that the kernel was compiled successfully and that a kernel image was created, with the following drivers as modules in the kernel USB subsystem: – configfs.ko – libcompostie.ko – usb_f_mass_storage.ko – atmel_usba_udc.ko – g_mass_storage.ko • Use the preferred console terminal - preferably Mincom in Linux and Tera Term in Windows, with the above-mentioned baud rate. • Power up the board. Make sure that the device is up, depending on the preferred boot media, and that the root filesystem has mounted successfully. Log in at the device prompt. • Copy all the above mentioned kernel modules from kernel USB subsystem located in /lib/modules/ /kernel/drivers/usb into your present location for easy loading of modules.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 31 AN2457

• Insert the USB mass storage device in any of the available host ports and perform the following steps: # insmod configfs.ko

# insmod libcomposite.ko

# insmod usb_f_mass_storage.ko

# insmod atmel_usba_udc.ko

# insmod g_mass_storage.ko file=/dev/sda

Number of LUNs=8

Mass Storage Function, version: 2009/09/11

LUN: removable file: (no medium)

Number of LUNs=1

LUN: file: /dev/sda

Number of LUNs=1

g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

g_mass_storage gadget: userspace failed to provide iSerialNumber

g_mass_storage gadget: g_mass_storage ready

modprobe can also be used to load above kernel modules. Note: /dev/sda is the mounting point of the attached USB mass storage device. Perform the above steps in order to detect the USB device connected on the host ports of the SAMA5Dx device on PC through the USB-A port which was connected for powering through the micro-B cable. Once the setup is done and the USB connected to the host port of the device is accessible through the PC, find the node of the device detected on the Linux PC using a command prompt, and proceed as explained in Demo Using a USB Optical Mouse Connected to Host Port B or C (D3/D4).

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 32 AN2457

11. USB Global Suspend Example • Before testing Global Suspend, a hardware setup must be performed. • Follow the steps provided in Hardware Setup for USB Selective Suspend • Before starting this demo, make sure that the latest software version is loaded and that the device is booting with Linux. For more information, refer to: http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d2XplainedMainPage#Demo • Once the device boots up, log in at the command prompt.

Poky (Yocto Project Reference Distro) 2.0.1 sama5d2-xplained-sd /dev/ttyS0

sama5d2-xplained-sd login:root

root@sama5d2-xplained-sd:~#

• Enter the following command to initiate Global Suspend of the device: root@sama5d2-xplained-sd:~# echo mem > /sys/power/state

PM: Syncing filesystems ... done.

Freezing processes ... (elapsed 0.005 second) done.

Freezing remaining freezable tasks ... (elapsed 0.003 second) done.

Suspending console(s) (use no_console_suspend to debug)

• The device resumes from Global Suspend when the user asserts the WAKE_UP signal to the processor. The following messages are delivered over the debug console once the device resumes from Global Suspend:

PM: suspend of devices complete after 122.288 msecs

PM: noirq resume of devices complete after 0.762 msecs

PM: early resume of devices complete after 0.751 msecs

usb usb2: root hub lost power or was reset

PM: resume of devices complete after 278.716 msecs

Restarting tasks ... done.

root@sama5d2-xplained-sd:~#

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 33 AN2457

12. Power Consumption during USB Suspend The following table depicts the updated power consumption data based on SAMA5D27 CN-ES1605C Rev B with BGA289_REVA (No. 6/10), MPM-VB_REVB (SH05) when the device is in Global Suspend. Table 12-1. SAMA5D2x Power Consumption during USB Suspend

Power Rail Voltage Range (V) USB Active USB Suspend Current (mA) Current (mA) VDDUTMIC 1.2 5.18 0.005 VDDUTMII 3.3 18.27 0.16 VDDHSIC 1.2 0.001

The following table depicts the updated power consumption data based on the default SAMA5D3 Power Consumption Demonstration Platform (RevC CMP+RevD MB+5" LCD) (code version: linux4sam- buildroot-sama5d3xek-cmp-demo-v1.0.zip) when the device is in Global Suspend. Software: Linux Low Power Mode Suspend to Mem (Global Suspend): echo mem > /sys/power/state Table 12-2. SAMA5D3x Power Consumption during USB Suspend

USB Standby (MCK=PCK=132 Suspend to Mem Active MHz) (MCK=PCK=512 MHz=32768 Hz (osc)/64) Power Rail Voltage Voltage (V) Current Current Power Current Power Range (V) (mA) (mA) Consumpti (mA) Consumpti on (mW) on (mW) VDDUTMIC 1.1~1.32 1.15 7.94 0.0095 0.01 0.0014 0.00 (JP3) VDDUTMII 3.0~3.6 3.3 22.95 0.0001 0.00 0.0001 0.00 (JP11)

The following table depicts the updated power consumption data based on SAMA5D4x-MB RevD TM7000 7'' PDA LCD (VS1034274 00061) when device is in Global Suspend. Software: Linux Low Power Mode Suspend to Mem (Global Suspend): echo mem > /sys/power/state Table 12-3. SAMA5D4X Power Consumption during USB Suspend

Standby (MCK=176 MHz, PCK Suspend to Mem (MCK=32768 disabled) Hz(osc)/3, PCK disabled) Power Rail Voltage (V) Current (mA) Power Current (mA) Power Consumption Consumption (mW) (mW) VDDUTMII (L46) 3.3 0.008 0.0264 0.003 0.0099

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 34 AN2457

13. USB Host Limitations and Corrections • SAMA5D3 experiences an issue of over power consumption when USB host ports (UHPHS) are used in High-speed mode (EHCI). In High-speed mode (EHCI), it is not possible to suspend the ports if no device is attached on each port. This leads to increased power consumption even if the system is in a low-power mode. However, this issue does not occur when the device is in Full- speed mode (OHCI). This over power consumption issue has been rectified in SAMA5D2 devices. • USB Suspend can be controlled by EHCI-OHCI or can be forced to fully suspended by connected ports. For this, the SFR_OHCIICR register has to be configured. For more detailed description, refer to Section “Special Function Registers” in the SAMA5D2 datasheet.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 35 AN2457

14. Revision History Table 14-1. Revision History

Doc. Rev. Changes A First release

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 36 AN2457

The Microchip Web Site

Microchip provides online support via our web site at http://www.microchip.com/. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software • General Technical Support – Frequently Asked Questions (FAQ), technical support requests, online discussion groups, Microchip consultant program member listing • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives

Customer Change Notification Service

Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. To register, access the Microchip web site at http://www.microchip.com/. Under “Support”, click on “Customer Change Notification” and follow the registration instructions.

Customer Support

Users of Microchip products can receive assistance through several channels: • Distributor or Representative • Local Sales Office • Field Application Engineer (FAE) • Technical Support Customers should contact their distributor, representative or Field Application Engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document. Technical support is available through the web site at: http://www.microchip.com/support

Microchip Devices Code Protection Feature

Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 37 AN2457

• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

Legal Notice

Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights unless otherwise stated.

Trademarks

The Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings, BitCloud, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, KeeLoq logo, Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA, SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip Technology Incorporated in the U.S.A. Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom, chipKIT, chipKIT logo, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial Programming, ICSP, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi, motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PureSilicon, QMatrix, RightTouch logo, REAL ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries. GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies. © 2017, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 38 AN2457

ISBN: 978-1-5224-1743-9

Quality Management System Certified by DNV

ISO/TS 16949 Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 39 Worldwide Sales and Service

AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office Asia Pacific Office China - Xiamen Austria - Wels 2355 West Chandler Blvd. Suites 3707-14, 37th Floor Tel: 86-592-2388138 Tel: 43-7242-2244-39 Chandler, AZ 85224-6199 Tower 6, The Gateway Fax: 86-592-2388130 Fax: 43-7242-2244-393 Tel: 480-792-7200 Harbour City, Kowloon China - Zhuhai Denmark - Copenhagen Fax: 480-792-7277 Hong Kong Tel: 86-756-3210040 Tel: 45-4450-2828 Technical Support: Tel: 852-2943-5100 Fax: 86-756-3210049 Fax: 45-4485-2829 http://www.microchip.com/ Fax: 852-2401-3431 India - Bangalore Finland - Espoo support Australia - Sydney Tel: 91-80-3090-4444 Tel: 358-9-4520-820 Web Address: Tel: 61-2-9868-6733 Fax: 91-80-3090-4123 France - Paris www.microchip.com Fax: 61-2-9868-6755 India - New Delhi Tel: 33-1-69-53-63-20 Atlanta China - Beijing Tel: 91-11-4160-8631 Fax: 33-1-69-30-90-79 Duluth, GA Tel: 86-10-8569-7000 Fax: 91-11-4160-8632 France - Saint Cloud Tel: 678-957-9614 Fax: 86-10-8528-2104 India - Pune Tel: 33-1-30-60-70-00 Fax: 678-957-1455 China - Chengdu Tel: 91-20-3019-1500 Germany - Garching Austin, TX Tel: 86-28-8665-5511 Japan - Osaka Tel: 49-8931-9700 Tel: 512-257-3370 Fax: 86-28-8665-7889 Tel: 81-6-6152-7160 Germany - Haan Boston China - Chongqing Fax: 81-6-6152-9310 Tel: 49-2129-3766400 Westborough, MA Tel: 86-23-8980-9588 Japan - Tokyo Germany - Heilbronn Tel: 774-760-0087 Fax: 86-23-8980-9500 Tel: 81-3-6880- 3770 Tel: 49-7131-67-3636 Fax: 774-760-0088 China - Dongguan Fax: 81-3-6880-3771 Germany - Karlsruhe Chicago Tel: 86-769-8702-9880 Korea - Daegu Tel: 49-721-625370 Itasca, IL China - Guangzhou Tel: 82-53-744-4301 Germany - Munich Tel: 630-285-0071 Tel: 86-20-8755-8029 Fax: 82-53-744-4302 Tel: 49-89-627-144-0 Fax: 630-285-0075 China - Hangzhou Korea - Seoul Fax: 49-89-627-144-44 Dallas Tel: 86-571-8792-8115 Tel: 82-2-554-7200 Germany - Rosenheim Addison, TX Fax: 86-571-8792-8116 Fax: 82-2-558-5932 or Tel: 49-8031-354-560 Tel: 972-818-7423 China - Hong Kong SAR 82-2-558-5934 Israel - Ra’anana Fax: 972-818-2924 Tel: 852-2943-5100 Malaysia - Kuala Lumpur Tel: 972-9-744-7705 Detroit Fax: 852-2401-3431 Tel: 60-3-6201-9857 Italy - Milan Novi, MI China - Nanjing Fax: 60-3-6201-9859 Tel: 39-0331-742611 Tel: 248-848-4000 Tel: 86-25-8473-2460 Malaysia - Penang Fax: 39-0331-466781 Houston, TX Fax: 86-25-8473-2470 Tel: 60-4-227-8870 Italy - Padova Tel: 281-894-5983 China - Qingdao Fax: 60-4-227-4068 Tel: 39-049-7625286 Indianapolis Tel: 86-532-8502-7355 Philippines - Manila Netherlands - Drunen Noblesville, IN Fax: 86-532-8502-7205 Tel: 63-2-634-9065 Tel: 31-416-690399 Tel: 317-773-8323 China - Shanghai Fax: 63-2-634-9069 Fax: 31-416-690340 Fax: 317-773-5453 Tel: 86-21-3326-8000 Singapore Norway - Trondheim Tel: 317-536-2380 Fax: 86-21-3326-8021 Tel: 65-6334-8870 Tel: 47-7289-7561 Los Angeles China - Shenyang Fax: 65-6334-8850 Poland - Warsaw Mission Viejo, CA Tel: 86-24-2334-2829 Taiwan - Hsin Chu Tel: 48-22-3325737 Tel: 949-462-9523 Fax: 86-24-2334-2393 Tel: 886-3-5778-366 Romania - Bucharest Fax: 949-462-9608 China - Shenzhen Fax: 886-3-5770-955 Tel: 40-21-407-87-50 Tel: 951-273-7800 Tel: 86-755-8864-2200 Taiwan - Kaohsiung Spain - Madrid Raleigh, NC Fax: 86-755-8203-1760 Tel: 886-7-213-7830 Tel: 34-91-708-08-90 Tel: 919-844-7510 China - Wuhan Taiwan - Taipei Fax: 34-91-708-08-91 New York, NY Tel: 86-27-5980-5300 Tel: 886-2-2508-8600 Sweden - Gothenberg Tel: 631-435-6000 Fax: 86-27-5980-5118 Fax: 886-2-2508-0102 Tel: 46-31-704-60-40 San Jose, CA China - Xian Thailand - Bangkok Sweden - Stockholm Tel: 408-735-9110 Tel: 86-29-8833-7252 Tel: 66-2-694-1351 Tel: 46-8-5090-4654 Tel: 408-436-4270 Fax: 86-29-8833-7256 Fax: 66-2-694-1350 UK - Wokingham Canada - Toronto Tel: 44-118-921-5800 Tel: 905-695-1980 Fax: 44-118-921-5820 Fax: 905-695-2078

© 2017 Microchip Technology Inc. Application Note DS00002457A-page 40