User manual
...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 327
www.energymicro.com
Figure 15.34. HNP When the Core is an A-Device
Read
USB_GINTSTS
USB_GOTGINT.
HSTNEGDET
=1?
No
Yes
Read
USB_GINTSTS.CURMOD
Program USB_HPRT.PRTSUSP = 1
Unmask USB_GINTSTS.OTGINT
Interrupt ?
Yes
No
Host to Device to Host
Program
USB_GOTGCTL .HSTSETHNPEN = 1
USB_GINTSTS.
OTGINT =1?
No
Interrupt ?
Yes
No
Yes
USB_GINTSTS.
CURMOD = 0?No
Rem ain as
Host (The host’s
application can
take a call whet her
to switch off VBUS
or not)
Yes
End of Device
transactions
Read
USB_GINTSTS
1. Unmask
USB_GINTSTS.ERLYSUSP
2. Device Initialization Steps.
For more inform ation
Device Initialization section
of this chapter.
Start of Device
transactions
C1
C1
Interrupt ?
No
No
Yes
Read
USB_GINTSTS
Interrupt ?
No
No
Yes
A-Device as USB Host
Read
USB_GINTSTS
Interrupt
within
200 ms
yes
No
Yes
No
A-Device as USB Device
Read USB_GINTSTS
Check that CURMOD
= 0
Host Mode
Transactions
Yes
Application start s
200 ms timer
Host Initialization
Steps.
For more
inform ation, see Host
Initialization section
of this chapter.
USB_GINTSTS.
ERLYSUSP = 1 ?
USB_GINTSTS.
USBSUSP = 1 ?
USB_GINTSTS.WKUPINT = 1
or
USB_GINTSTS.RESETDET ?
Host mode
(Send SetFeature Com mand to enable
b_hnp_enable feature in HNP capable
devices. HNP polling m echanism is also
involved. This is done when OTG FSM
is in a_host st ate)
, see
?
Figure 15.35 (p. 328) shows the programming steps that need to be performed by B-device’s
application (core as B-device) in order to change its role to Host. In Figure 15.35 (p. 328) , the B-
device performs a role change, becomes a Host and then reverts back to Device mode of operation.