29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RM0008<br />

USB on-the-go full-speed (OTG_FS)<br />

The OTG FS Core provides:<br />

●<br />

means to monitor, track <strong>and</strong> configure SOF framing in the host <strong>and</strong> peripheral<br />

● an SOF pulse output connectivity feature<br />

Such utilities are especially useful for adaptive audio clock generation techniques, where the<br />

audio peripheral needs to synchronize to the isochronous stream provided by the PC, or the<br />

Host needs to trim its framing rate according to the requirements of the audio peripheral.<br />

26.7.1 Host SOFs<br />

In Host mode the number of PHY clocks occurring between the generation of two<br />

consecutive SOF (FS) or Keep-alive (LS) tokens is programmable in the host frame interval<br />

register (HFIR), thus providing application control over the SOF framing period. An interrupt<br />

is generated at any start of frame (SOF bit in OTH_FS_GINTSTS). The current frame<br />

number <strong>and</strong> the time remaining until the next SOF are tracked in the host frame number<br />

register (HFNUM).<br />

An SOF pulse signal, generated at any SOF starting token <strong>and</strong> with a width of 12 system<br />

clock cycles, can be made available externally on the SOF pin using the SOFOUTEN bit in<br />

the global control <strong>and</strong> configuration register. The SOF pulse is also internally connected to<br />

the input trigger of timer 2 (TIM2), so that the input capture feature, the output compare<br />

feature <strong>and</strong> the timer can be triggered by the SOF pulse. The TIM2 connection is enabled by<br />

bit 29 in the REMAP_DBGAFR register.<br />

26.7.2 Peripheral SOFs<br />

In Device mode, the start of frame interrupt is generated each time an SOF token is received<br />

on the USB (SOF bit in OTH_FS_GINTSTS). The corresponding frame number can be read<br />

from the device status register (FNSOF bit in OTG_FS_DSTS). An SOF pulse signal with a<br />

width of 12 system clock cycles is also generated <strong>and</strong> can be made available externally on<br />

the SOF pin by using the SOF output enable bit in the global control <strong>and</strong> configuration<br />

register (SOFOUTEN bit in OTG_FS_GCCFG). The SOF pulse signal is also internally<br />

connected to the TIM2 input trigger, so that the input capture feature, the output compare<br />

feature <strong>and</strong> the timer can be triggered by the SOF pulse. The TIM2 connection is enabled by<br />

bit 29 in the REMAP_DBGAFR register.<br />

The end of periodic frame interrupt (GINTSTS/EOPF) is used to notify the application when<br />

80%, 85%, 90% or 95% of the time frame interval elapsed depending on the periodic frame<br />

interval field in the device configuration register (PFIVL bit in OTG_FS_DCFG). This feature<br />

can be used to determine if all of the isochronous traffic for that frame is complete.<br />

Doc ID 13902 Rev 9 709/995

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!