User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 328
www.energymicro.com
Figure 15.35. HNP When the Core is a B-Device
1. Program
2. Program
Read
USB_GINTSTS
Interrupt ?
No
No
Yes
Read
USB_GINTSTS
Interrupt ?
No
No
Yes
Read
USB_GINTSTS
Interrupt ?
Yes
No
No
Yes
C1
C1
Read
USB_GOTGINT
Yes
No
Read
USB_GOTGCTL
Yes
No
Rem ain as
Device
Start of Host
transactions
End of Host
transactions
Does B-
device want
to remain
host?
Yes
6.1. 1
Host Initialization
No
Read
USB_GINTSTS
Interrupt ?
No
No
Yes
Device Mode
Transactions
The application
should ensure that
this process happens
within 200 m s
Read USB_GINTSTS.CURMOD
and ensure it is 0.
Device Initialization Steps.
For more inform ation,see
Device Initialization
section in this chapter.
USB_GOTGINT.
HSTNEGSUCSTSCHNG = 1 ?
USB_GOTGCTL.DEVSETHNPEN = 1
USB_GOTGCTL.HNPREQ = 1
USB_GINTSTS.
ERLYSUSP = 1?
USB_GINTSTS.
USBSUSP = 1?
USB_GINTSTS.
OTGINT = 1?
Clear USB_GOTGINT.
HSTNEGSUCSTSCHNG
USB_GOTGCTL.
HSTNEGSUCS = 1 ?
Read USB_GINTSTS. Check
that CURMOD = 1.
Host Initialization Steps
(USB_HPRT.PRTPWR should
not be programm ed). For m ore
inform ation, see Host
Initialization section in this
chapter.
Set USB_HPRT.PRTSUSP = 1.
Unmask GINTSTS.OTGINT.
(USB_HPRT.PRTPWR should
not be programm ed)
Program
USB_HPRT.PRTRES = 1 for
a predefined tim e.
USB_GINTSTS.
DISCONNINT = 1 ?
Device m ode
(Receive SetFeature
Com m and and OTG FSM
is in b_peripheral state)
Note
During HNP process where the B-device is going to assume the role of a host, the B-device
application needs to ensure that a USB reset process is programmed (in USB_HPRT