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.

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

RM0008<br />

3. When the application pops the Global OUT NAK pattern DWORD from the receive<br />

FIFO, the core sets the GONAKEFF interrupt (OTG_FS_GINTSTS).<br />

4. Once the application detects this interrupt, it can assume that the core is in Global OUT<br />

NAK mode. The application can clear this interrupt by clearing the SGONAK bit in<br />

OTG_FS_DCTL.<br />

Application programming sequence<br />

1. To stop receiving any kind of data in the receive FIFO, the application must set the<br />

Global OUT NAK bit by programming the following field:<br />

– SGONAK = 1 in OTG_FS_DCTL<br />

2. Wait for the assertion of the GONAKEFF interrupt in OTG_FS_GINTSTS. When<br />

asserted, this interrupt indicates that the core has stopped receiving any type of data<br />

except SETUP packets.<br />

3. The application can receive valid OUT packets after it has set SGONAK in<br />

OTG_FS_DCTL <strong>and</strong> before the core asserts the GONAKEFF interrupt<br />

(OTG_FS_GINTSTS).<br />

4. The application can temporarily mask this interrupt by writing to the GINAKEFFM bit in<br />

GINTMSK.<br />

– GINAKEFFM = 0 in GINTMSK<br />

5. Whenever the application is ready to exit the Global OUT NAK mode, it must clear the<br />

SGONAK bit in OTG_FS_DCTL. This also clears the GONAKEFF interrupt<br />

(OTG_FS_GINTSTS).<br />

– OTG_FS_DCTL = 1 in CGONAK<br />

6. If the application has masked this interrupt earlier, it must be unmasked as follows:<br />

– GINAKEFFM = 1 in GINTMSK<br />

● Disabling an OUT endpoint<br />

The application must use this sequence to disable an OUT endpoint that it has enabled.<br />

Application programming sequence:<br />

1. Before disabling any OUT endpoint, the application must enable Global OUT NAK<br />

mode in the core.<br />

– SGONAK = 1 in OTG_FS_DCTL<br />

2. Wait for the GONAKEFF interrupt (OTG_FS_GINTSTS)<br />

3. Disable the required OUT endpoint by programming the following fields:<br />

– EPDIS = 1 in OTG_FS_DOEPCTLx<br />

– SNAK = 1 in OTG_FS_DOEPCTLx<br />

4. Wait for the EPDISD interrupt (OTG_FS_DOEPINTx), which indicates that the OUT<br />

endpoint is completely disabled. When the EPDISD interrupt is asserted, the core also<br />

clears the following bits:<br />

– EPDIS = 0 in OTG_FS_DOEPCTLx<br />

– EPENA = 0 in OTG_FS_DOEPCTLx<br />

5. The application must clear the Global OUT NAK bit to start receiving data from other<br />

non-disabled OUT endpoints.<br />

– SGONAK = 0 in OTG_FS_DCTL<br />

816/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!