09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

USB on-the-go high-speed (OTG_HS) <strong>RM0090</strong><br />

1. Program the GINTMSK register to unmask the following:<br />

2. Channel interrupt<br />

– Nonperiodic transmit FIFO empty for OUT transactions (applicable for Slave mode<br />

that operates in pipelined transaction-level with the packet count field programmed<br />

with more than one).<br />

– Nonperiodic transmit FIFO half-empty for OUT transactions (applicable for Slave<br />

mode that operates in pipelined transaction-level with the packet count field<br />

programmed with more than one).<br />

3. Program the OTG_HS_HAINTMSK register to unmask the selected channels’<br />

interrupts.<br />

4. Program the OTG_HS_HCINTMSK register to unmask the transaction-related<br />

interrupts of interest given in the host channel interrupt register.<br />

5. Program the selected channel’s OTG_HS_HCTSIZx register with the total transfer size,<br />

in bytes, and the expected number of packets, including short packets. The application<br />

must program the PID field with the initial data PID (to be used on the first OUT<br />

transaction or to be expected from the first IN transaction).<br />

6. Program the selected channels in the OTG_HS_HCSPLTx register(s) with the hub and<br />

port addresses (split transactions only).<br />

7. Program the selected channels in the HCDMAx register(s) with the buffer start address.<br />

8. Program the OTG_HS_HCCHARx register of the selected channel with the device’s<br />

endpoint characteristics, such as type, speed, direction, and so forth. (The channel can<br />

be enabled by setting the channel enable bit to 1 only when the application is ready to<br />

transmit or receive any packet).<br />

Halting a channel<br />

The application can disable any channel by programming the OTG_HS_HCCHARx register<br />

with the CHDIS and CHENA bits set to 1. This enables the OTG_HS host to flush the posted<br />

requests (if any) and generates a channel halted interrupt. The application must wait for the<br />

CHH interrupt in OTG_HS_HCINTx before reallocating the channel for other transactions.<br />

The OTG_HS host does not interrupt the transaction that has already been started on the<br />

USB.<br />

To disable a channel in DMA mode operation, the application does not need to check for<br />

space in the request queue. The OTG_HS host checks for space to write the disable request<br />

on the disabled channel’s turn during arbitration. Meanwhile, all posted requests are<br />

dropped from the request queue when the CHDIS bit in HCCHARx is set to 1.<br />

Before disabling a channel, the application must ensure that there is at least one free space<br />

available in the nonperiodic request queue (when disabling a nonperiodic channel) or the<br />

periodic request queue (when disabling a periodic channel). The application can simply<br />

flush the posted requests when the Request queue is full (before disabling the channel), by<br />

programming the OTG_HS_HCCHARx register with the CHDIS bit set to 1, and the CHENA<br />

bit cleared to 0.<br />

The application is expected to disable a channel on any of the following conditions:<br />

1. When an XFRC interrupt in OTG_HS_HCINTx is received during a nonperiodic IN<br />

transfer or high-bandwidth interrupt IN transfer (Slave mode only)<br />

2. When an STALL, TXERR, BBERR or DTERR interrupt in OTG_HS_HCINTx is received<br />

for an IN or OUT channel (Slave mode only). For high-bandwidth interrupt INs in Slave<br />

mode, once the application has received a DTERR interrupt it must disable the channel<br />

1259/1416 Doc ID 018909 Rev 3

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

Saved successfully!

Ooh no, something went wrong!