address of the endpoint descriptors needs to be written in the Descriptor Address register (DESCADD) by
the user. Refer also to the Endpoint Descriptor structure in
Before using an endpoint, the user should configure the direction and type of the endpoint in Type of
Endpoint field in the Device Endpoint Configuration register (EPCFG.EPTYPE0/1). The endpoint
descriptor registers should be initialized to known values before using the endpoint, so that the USB
controller does not read random values from the RAM.
The Endpoint Size field in the Packet Size register (PCKSIZE.SIZE) should be configured as per the size
reported to the host for that endpoint. The Address of Data Buffer register (ADDR) should be set to the
data buffer used for endpoint transfers.
The RAM Access Interrupt bit in Device Interrupt Flag register (INTFLAG.RAMACER) is set when a RAM
access underflow error occurs during IN data stage.
When an endpoint is disabled, the following registers are cleared for that endpoint:
•
Device Endpoint Interrupt Enable Clear/Set (EPINTENCLR/SET) register
•
Device Endpoint Interrupt Flag (EPINTFLAG) register
•
Transmit Stall 0 bit in the Endpoint Status register (EPSTATUS.STALLRQ0)
•
Transmit Stall 1 bit in the Endpoint Status register (EPSTATUS.STALLRQ1)
39.6.2.3. Multi-Packet Transfers
Multi-packet transfer enables a data payload exceeding the endpoint maximum transfer size to be
transferred as multiple packets without software intervention. This reduces the number of interrupts and
software intervention required to manage higher level USB transfers. Multi-packet transfer is identical to
the IN and OUT transactions described below unless otherwise noted in this section.
The application software provides the size and address of the RAM buffer to be proceeded by the USB
module for a specific endpoint, and the USB module will split the buffer in the required USB data transfers
without any software intervention.
39.6.2.4. USB Reset
The USB bus reset is initiated by a connected host and managed by hardware.
During USB reset the following registers are cleared:
•
Device Endpoint Configuration (EPCFG) register - except for Endpoint 0
•
Device Frame Number (FNUM) register
•
Device Address (DADD) register
•
Device Endpoint Interrupt Enable Clear/Set (EPINTENCLR/SET) register
•
Device Endpoint Interrupt Flag (EPINTFLAG) register
•
Transmit Stall 0 bit in the Endpoint Status register (EPSTATUS.STALLRQ0)
•
Transmit Stall 1 bit in the Endpoint Status register (EPSTATUS.STALLRQ1)
•
Endpoint Interrupt Summary (EPINTSMRY) register
•
Upstream resume bit in the Control B register (CTRLB.UPRSM)
At the end of the reset process, the End of Reset bit is set in the Interrupt Flag register
(INTFLAG.EORST).
39.6.2.5. Start-of-Frame
When a Start-of-Frame (SOF) token is detected, the frame number from the token is stored in the Frame
Number field in the Device Frame Number register (FNUM.FNUM), and the Start-of-Frame interrupt bit in
the Device Interrupt Flag register (INTFLAG.SOF) is set. If there is a CRC or bit-stuff error, the Frame
Number Error status flag (FNUM.FNCERR) in the FNUM register is set.
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
923