28.5.4 Endpoint Control

Name: CTRL
Offset: 0x01 + n*0x08 [n=0..1]
Reset: 0x00

Bit 76543210 
 TYPE[1:0]MULTIPKTAZLPTCDSBLDOSTALLBUFSIZE[1:0] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset xxxxxxxx 

Bits 7:6 – TYPE[1:0] Endpoint Type

These bits enable and select the endpoint type. If the endpoint is disabled, the remaining seven endpoint configuration bytes are never read or written by the USB peripheral, and their RAM locations are free to use for other application data.

ValueNameDescription
0x0 DISABLE Endpoint Disabled
0x1 CONTROL Control
0x2 BULKINT Bulk or Interrupt
0x3 ISOCHRONOUS Isochronous

Bit 5 – MULTIPKT Multi-packet Transfer Enable

Writing this bit to ‘1’ enables multi-packet transfers. The multi-packet transfer enables a data payload exceeding the maximum packet size of an endpoint to be transferred as multiple packets without interrupts or firmware intervention. When MULTIPKT is ‘1’, MCNT defines the maximum size of a single OUT packet, thereby preventing the data reception buffer overrun.

Bit 4 – AZLP Automatic Zero Length Packet

Writing this bit to ‘1’ allows the USB peripheral to manage a transaction complete signaling with ZLP, without firmware interaction. When Multi-packet Transfer Enable (MULTIPKT) is disabled, this bit has no effect. The behavior depends on the transfer direction:

IN: An ZLP is automatically sent if the last data packet of a multi-packet transfer is equal to ep_size.

OUT: If the last packet of a multi-packet transfer was equal to ep_size, the Transaction Complete (TRNCOMPL) flag and interrupt will be set by the next ZLP.

Bit 3 – TCDSBL TRNCOMPL Interrupt Disable

When this bit is written to ‘1’, the Transaction Complete (TRNCOMPL) flag in the Interrupt Flags B (INTFLAGSB) register is not set together with the TRNCOMPL flag of the endpoint in the Endpoint Status (EPn.STATUS) register. The FIFO will not store the endpoint configuration table address for this endpoint until transaction completes, if TCDSBL is ‘1’.

Bit 2 – DOSTALL Endpoint Will Respond with STALL

When this bit is written to ‘1’, the USB controller will respond to IN or OUT transactions with a STALL handshake. No STALL will be sent if the endpoint is a control endpoint and the Endpoint Setup (EPSETUP) bit in the EPn STATUS register is ‘1’. DOSTALL is direction-specific, i.e., IN transactions are stalled if IN.CTRL.DOSTALL is set and OUT transactions are stalled if OUT.CTRL.DOSTALL is set.

STATUS.EPSETUP for control IN endpoints can override CTRL.DOSTALL, ensuring that the device will not STALL the data or the status stage of a control transfer before the CPU has had time to process the request, in case CTRL.DOSTALL was set from the previous request.

Bits 1:0 – BUFSIZE[1:0] Data Size (Default)

This bit field configures the maximum data payload size for the endpoint. Incoming data bytes exceeding the maximum data payload size are discarded. For control endpoints, this field only affects IN and OUT transactions. For SETUP transaction, the maximum data payload is always of eight bytes.

ValueNameDescription
0x0 DEFAULT_BUF8 8 bytes buffer size
0x1 DEFAULT_BUF16 16 bytes buffer size
0x2 DEFAULT_BUF32 32 bytes buffer size
0x3 DEFAULT_BUF64 64 bytes buffer size