12.7. USB
12.7.1. Overview
NOTE
Prerequisite knowledge required
This section requires knowledge of the USB protocol. If you aren't yet familiar with the USB protocol, we recommend the archive of the very useful USB Made Simple website. For formal definitions of the terminology used in this section, see the USB 2.0 Specification .
RP2350 contains a USB 2.0 controller that can operate as either:
- • a Full Speed (FS) device (12 Mb/s)
- • a host that can communicate with both Low Speed (LS) (1.5 Mb/s) and Full Speed devices, including multiple downstream devices connected to a USB hub
There is an integrated USB 1.1 PHY which interfaces the USB controller with the DP and DM pins of the chip. You may use this as 3.3 V GPIO when the USB controller is not in use.
12.7.2.1. Errata fixes
RP2350 fixes all RP2040 USB errata. This includes fixes for the following RP2040B0 and B1 errata which are also fixed by RP2040B2:
- • RP2040-E2: USB device endpoint abort is not cleared
- • RP2040-E5: USB device fails to exit RESET state on busy USB bus
For more information about RP2040B2, see the RP2040 datasheet.
RP2350 fixes the following RP2040B2 errata, which require software workarounds on RP2040B2:
- • RP2040-E3: USB host: interrupt endpoint buffer done flag can be set with incorrect buffer select
- • RP2040-E4: USB host writes to upper half of buffer status in single buffered mode
- • RP2040-E15: USB Device controller will hang if certain bus errors occur during an IN transfer (see Section 12.7.2.2.4 )
12.7.2.2. New features
12.7.2.2.1. General
- • The USB PHY DP and DM can be used as regular GPIO pins. See the GPIO muxing Table 646 in Section 9.4 .
- • A MAIN_CTRL.PHY_ISO control isolates the PHY from the switched core power domain while the switched core domain is powered down. The isolation control resets to 1, meaning the MAIN_CTRL.PHY_ISO bit needs to be cleared before the PHY can be used. For more information on isolation, see Chapter 9 .
- • SIE_CTRL.PULLDOWN_EN defaults to a 1 to match the reset state of isolation latches in the USB PHY. Pulling the DP and DM pins down by default saves power by preventing them from floating when unused.
- • The USB_MUXING.TO_PHY bit defaults to a 1 to match the reset state of isolation latches.
- • Added SM_STATE , which exposes the internal state of the controller's modules.
12.7.2.2.2. Host
- • You can now optionally stop a transaction if a
NAK
is received. This allows the USB host to stop a bulk transaction if the device is not able to transfer data. Some devices using bulk endpoints, such as a UART, will return
NAKs
until a character is received. Stopping the transaction in hardware rather than using software means the host can get a
NAK
and guarantee no data has been dropped. RP2350 adds two register bits and an interrupt to support this:
- ◦ The NAK_POLL.STOP_EPX_ON_NAK control, which enables and disables the feature.
- ◦ The NAK_POLL.EPX_STOPPED_ON_NAK status bit, which also has an associated interrupt INTS.EPX_STOPPED_ON_NAK .
- • RP2350 increases inter-packet and turnaround timeouts to accommodate worst-case hub delays. This issue, only seen with long chains of USB hubs, was never seen in practice. Timings in the host state machine have been corrected to match USB spec. This fix is enabled by LINESTATE_TUNING.MULTI_HUB_FIX .
12.7.2.2.3. Device
- • Added wake from suspend fix: Any bus activity (defined as K or SE0 ) should cause a wake from suspend, not just a qualified period of resume signalling. This fix is enabled by default and can be disabled with LINESTATE_TUNING.DEV_LS_WAKE_FIX ( LS means line state in this instance, not low speed).
- • Added DPSRAM double read feature to ensure data consistency. This avoids the need to set the AVAILABLE bit in the buffer control register separate to the rest of the buffer information. This feature is enabled by default and controlled by LINESTATE_TUNING.DEV_BUFF_CONTROL_DOUBLE_READ_FIX .
- • Added ability to stop DEVICE OUT FROM HOST when a short packet is received. For EP0 this is controlled by SIE_CTRL.EP0_STOP_ON_SHORT_PACKET . This is done by stopping the transaction and then not toggling the buffer if in double buffered mode. Also added short_packet interrupt to notify software that a short packet has been received ( INTS.RX_SHORT_PACKET )
12.7.2.2.4. Device error handling
- • Added DEV_RX_ERR QUIESCE feature: the device endpoint error count replicates the host's internal Cerr count so software can detect if the host has probably halted the endpoint after three consecutive errors. The various stages of RX decode generate their own error signals that propagate to the top level. These error signals arrive at different times, so two error interrupts generate for every failed transfer. Added an optional override for this behaviour by forcing the device RX controller to idle after the first instance of an error during a transfer. This fix is enabled with LINESTATE_TUNING.DEV_RX_ERR QUIESCE .
- • Added SIE_RX_CHATTER_SE0_FIX : the existing error recovery implementation waits for 8 FS idle bit-times before signalling a framing error and returning to idle. This works OK for random bus errors, but when a hub terminates a downstream packet, the hub forces a bit-stuff error followed by EOP. A valid token from the host may immediately follow this, but the device controller may ignore it due to the enforced delay. Optionally waits for either a valid EOP or 8 idle bit times before signalling a framing error. To enable the fix, use LINESTATE_TUNING.SIE_RX_CHATTER_SE0_FIX .
- • Fix RP2040-E15: the receive state machine doesn't always handle cases where the bitstream deserialiser can abort a transfer. If decoding terminates due to bitstuff errors during the middle phases of a packet, the device controller can lock up. Unconditionally disables RX if the deserialiser has flagged a bitstuff error and subsequently signalled framing error after linestate returns to idle. To enable this fix, use LINESTATE_TUNING.SIE_RX_BITSTUFF_FIX .
- • Device state machine watchdog: added a watchdog so that if the device state machine gets stuck for a certain amount of time it can be forced to idle. This is to handle any other error cases not anticipated by the above fixes. To enable the watchdog, use DEV_SM_WATCHDOG .
12.7.3. Architecture
12.7.3.1. Clock speed
This controller requires clk_usb to be running at 48MHz.
i NOTE
clk_sys must also be running at > 48MHz. See RP2350-E12 .
12.7.3.2. Overview
Figure 124. A simplified overview of the USB controller architecture.

The USB controller is an area-efficient design that muxes a device controller or host controller onto a common set of components. Each component is detailed below.
12.7.3.3. USB PHY
The USB PHY provides the electrical interface between the USB DP and DM pins and the digital logic of the controller. The DP and DM pins are a differential pair, meaning the values are always the inverse of each other, except to encode a specific line state (e.g. SE0 ). The USB PHY drives the DP and DM pins to transmit data and performs a differential receive of any incoming data. The USB PHY provides both single-ended and differential receive data to the line state detection module.
The USB PHY has built in pull-up and pull-down resistors. When the controller acts as a Full Speed device, the DP pin is pulled up to indicate to the host that a Full Speed device has been connected. In host mode, a weak pull-down is applied to DP and DM so that the lines are pulled to a logical zero until the device pulls up DP for Full Speed or DM for Low Speed.
12.7.3.4. Line state detection
The USB 2.0 Specification defines several line states (Bus Reset, Connected, Suspend, Resume, Data 1, Data 0, etc.) that need to be detected. The line state detection module has several state machines to detect these states and signal events to the other hardware components. There is no shared clock signal in USB, so the RX data must be sampled by an internal clock. The maximum data rate of USB Full Speed is 12 Mb/s. The RX data is sampled at 48MHz, giving 4 clock cycles to capture and filter the bus state. The line state detection module distributes the filtered RX data to the Serial RX Engine.
12.7.3.5. Serial RX engine
The serial receive (RX) engine decodes receive data captured by the line state detection module. It produces the following information:
- • The PID of the incoming data packet
- • The device address for the incoming data
- • The device endpoint for the incoming data
- • Data bytes
The serial receive engine also detects errors in RX data by performing a CRC check on the incoming data. Any errors are signalled to the other hardware blocks and can raise an interrupt.
NOTEIf you disconnect the USB cable during packet transfer in either host or device mode, the hardware will raise errors. Software must account for this scenario if you enable error interrupts.
12.7.3.6. Serial TX engineThe serial transmit (TX) engine is a mirror of the serial receive engine. It is connected to the currently active controller (either device or host). It creates TOKEN and DATA packets, calculates the CRC, and transmits them on the bus.
12.7.3.7. DPSRAMThe USB controller uses 4 kB (4096 bytes) of Dual Port SRAM (DPSRAM) to store control registers and data buffers. The DPSRAM is accessible as a 32-bit wide memory at address 0 of the USB controller ( 0x50100000 ).
The DPSRAM has the following characteristics, which differ from most registers on RP2350:
- • Supports 8-bit, 16-bit, and 32-bit accesses (typically, RP2350 registers only support 32-bit accesses)
- • Does not support set/clear aliases. (typically, RP2350 registers support these)
Data Buffers are typically 64 bytes long, as this is the maximum normal packet size for most Full Speed packets. Isochronous endpoints support a maximum buffer size of 1023 bytes. For other packet types, the maximum size is 64 bytes per buffer.
12.7.3.7.1. Concurrent accessThe DPSRAM in the USB controller is asynchronous. The dual port part of the name indicates that both the processor and the USB controller have ports to read and write, and these two ports are in different clock domains. As a result, the processor and USB controller can access the same memory address at the same time. One could write and one could read simultaneously. This could result in inconsistent data reads. You can avoid this scenario by following the rules outlined in this section.
The AVAILABLE bit in the buffer control register indicates who has ownership of a buffer. Set this bit to 1 from the processor to give the controller ownership of the buffer. When it has finished using the buffer, the controller sets the bit back to 0. Set the AVAILABLE bit separately from the rest of the data in the buffer control register so that the rest of the data in the buffer control register is accurate when the AVAILABLE bit is set.
This is necessary because the processor clock clk_sys can run several times faster than the clk_usb clock. Therefore clk_sys can update the data during a USB controller read on a slower clock. The correct process is:
- 1. Write buffer information (length, etc.) to the buffer control register.
- 2. nop for some clk_sys cycles to ensure that at least one clk_usb cycle passes. Consider a scenario where clk_sys runs at 125MHz and clk_usb runs at 48MHz. Because \( \lceil \frac{125}{48} \rceil = 3 \) , you should issue 3 nop instructions between the writes to guarantee that at least one clk_usb cycle has passed.
- 3. Set the AVAILABLE bit.
If clk_sys and clk_usb run at the same frequency, then it is not necessary to set the AVAILABLE bit separately.
NOTEWhen the USB controller writes the status back to the DPSRAM, it does a 16-bit write to the lower 2 bytes for buffer 0 and the upper 2 bytes for buffer 1. When using double-buffered mode, always treat the buffer control register as two 16-bit registers when updating it in software.
12.7.3.7.2. LayoutAddresses
0x0→
0xff are used for control registers containing configuration data. The remaining space, addresses
0x100→
0xffff(3840 bytes) can be used for data buffers. The controller has control registers that start at address
0x10000.
The memory layout depends on the USB controller mode:
- • In Device mode, the host can access multiple endpoints, so each endpoint must have endpoint control and buffer control registers.
- • In Host mode, the host software running on the processor decides which endpoints and devices to access. This only requires one set of endpoint control and buffer control registers. As well as software-driven transfers, the host controller can poll up to 15 interrupt endpoints and has a register for each of these interrupt endpoints.
Table 1192. DPSRAM layout
| Offset | Device Function | Host Function |
|---|---|---|
0x0 | Setup packet (8 bytes) | |
0x8 | EP1 in control | Interrupt endpoint control 1 |
0xc | EP1 out control | Spare |
0x10 | EP2 in control | Interrupt endpoint control 2 |
0x14 | EP2 out control | Spare |
0x18 | EP3 in control | Interrupt endpoint control 3 |
0x1c | EP3 out control | Spare |
0x20 | EP4 in control | Interrupt endpoint control 4 |
0x24 | EP4 out control | Spare |
0x28 | EP5 in control | Interrupt endpoint control 5 |
0x2c | EP5 out control | Spare |
0x30 | EP6 in control | Interrupt endpoint control 6 |
0x34 | EP6 out control | Spare |
0x38 | EP7 in control | Interrupt endpoint control 7 |
0x3c | EP7 out control | Spare |
0x40 | EP8 in control | Interrupt endpoint control 8 |
0x44 | EP8 out control | Spare |
0x48 | EP9 in control | Interrupt endpoint control 9 |
0x4c | EP9 out control | Spare |
0x50 | EP10 in control | Interrupt endpoint control 10 |
0x54 | EP10 out control | Spare |
0x58 | EP11 in control | Interrupt endpoint control 11 |
| Offset | Device Function | Host Function |
|---|---|---|
| 0x5c | EP11 out control | Spare |
| 0x60 | EP12 in control | Interrupt endpoint control 12 |
| 0x64 | EP12 out control | Spare |
| 0x68 | EP13 in control | Interrupt endpoint control 13 |
| 0x6c | EP13 out control | Spare |
| 0x70 | EP14 in control | Interrupt endpoint control 14 |
| 0x74 | EP14 out control | Spare |
| 0x78 | EP15 in control | Interrupt endpoint control 15 |
| 0x7c | EP15 out control | Spare |
| 0x80 | EP0 in buffer control | EPx buffer control |
| 0x84 | EP0 out buffer control | Spare |
| 0x88 | EP1 in buffer control | Interrupt endpoint buffer control 1 |
| 0x8c | EP1 out buffer control | Spare |
| 0x90 | EP2 in buffer control | Interrupt endpoint buffer control 2 |
| 0x94 | EP2 out buffer control | Spare |
| 0x98 | EP3 in buffer control | Interrupt endpoint buffer control 3 |
| 0x9c | EP3 out buffer control | Spare |
| 0xa0 | EP4 in buffer control | Interrupt endpoint buffer control 4 |
| 0xa4 | EP4 out buffer control | Spare |
| 0xa8 | EP5 in buffer control | Interrupt endpoint buffer control 5 |
| 0xac | EP5 out buffer control | Spare |
| 0xb0 | EP6 in buffer control | Interrupt endpoint buffer control 6 |
| 0xb4 | EP6 out buffer control | Spare |
| 0xb8 | EP7 in buffer control | Interrupt endpoint buffer control 7 |
| 0xbc | EP7 out buffer control | Spare |
| 0xc0 | EP8 in buffer control | Interrupt endpoint buffer control 8 |
| 0xc4 | EP8 out buffer control | Spare |
| 0xc8 | EP9 in buffer control | Interrupt endpoint buffer control 9 |
| 0xcc | EP9 out buffer control | Spare |
| 0xd0 | EP10 in buffer control | Interrupt endpoint buffer control 10 |
| 0xd4 | EP10 out buffer control | Spare |
| 0xd8 | EP11 in buffer control | Interrupt endpoint buffer control 11 |
| 0xdc | EP11 out buffer control | Spare |
| 0xe0 | EP12 in buffer control | Interrupt endpoint buffer control 12 |
| 0xe4 | EP12 out buffer control | Spare |
| 0xe8 | EP13 in buffer control | Interrupt endpoint buffer control 13 |
| Offset | Device Function | Host Function | Column 3 |
|---|---|---|---|
| 0xec | EP13 | out buffer control | Spare |
| 0xf0 | EP14 | in buffer control | Interrupt endpoint buffer control 14 |
| 0xf4 | EP14 | out buffer control | Spare |
| 0xf8 | EP15 | in buffer control | Interrupt endpoint buffer control 15 |
| 0xfc | EP15 | out buffer control | Spare |
| 0x100 | EP0 | buffer 0 (shared between in and out) | EPx control |
| 0x140 | Optional EP0 | buffer 1 | Spare |
| 0x180 0x180 | Data buffers | ||
| • A device must support Endpoint 0 so that it can reply to | SETUP | packets and be enumerated. As a result, there is no | |
| endpoint control register for | EP0 . Its buffers begin at | 0x100 . All other endpoints can have either single or dual buffers and | |
| are mapped at the base address programmed. As | EP0 has no endpoint control register, the interrupt enable controls for | ||
| EP0 come from SIE_CTRL. Table 1193. Endpoint | |||
| Bit(s) control register layout | Device Function | Host Function | |
| 31 | Endpoint enable Endpoint enable | ||
| 30 | Single buffered (64 bytes) = 0, Double buffered (64 bytes | × 2) = 1 | |
| 29 | Enable interrupt for every transferred buffer | ||
| 28 | Enable interrupt for every 2 transferred buffers (valid for double-buffered only) | ||
| 27:26 27:26 | Endpoint Type: Control = 0, Isochronous = 1, Bulk = 2, Interrupt = 3 | ||
| 25:18 | N/A | The interval the host controller should poll this endpoint. Only applicable for interrupt | |
| 17 | Interrupt on STALL | ||
| 16 | Interrupt on NAK | value of 9 would poll the endpoint every 10ms. | |
| 15:6 15:6 | Address base offset in DPSRAM of data buffer(s) |
12.7.3.7.3. Endpoint control register
The endpoint control register is used to configure an endpoint. It defines:
- • The endpoint type
- • The base address of the endpoint’s data buffer (or data buffers if double-buffered)
- • Which endpoint events trigger the controller interrupt output
A device must support Endpoint 0 so that it can reply to SETUP packets and be enumerated. As a result, there is no endpoint control register for EP0 . Its buffers begin at 0x100 . All other endpoints can have either single or dual buffers and are mapped at the base address programmed. As EP0 has no endpoint control register, the interrupt enable controls for EP0 come from SIE_CTRL .
Table 1193. Endpoint control register layout
NOTE
The data buffer base address must be 64-byte aligned, since bits 0 through 5 are ignored.
12.7.3.7.4. Buffer control register
The buffer control register contains information about the state of the data buffers for that endpoint. It is shared between the processor and the controller. If the endpoint is configured to be single-buffered, only the first half (bits 0 through 15) of the buffer are used.
If double buffering, the buffer select starts at buffer 0. From then on, the buffer select flips between buffer 0 and 1
unless the reset buffer select bit is set (which resets the buffer select to buffer 0). The value of the buffer select is internal to the controller and not accessible by the processor.
For host interrupt and isochronous packets on EPx , the buffer full bit will be set on completion even if the transfer was unsuccessful. To determine the error, read the error bits in the SIE_STATUS register.
Table 1194. Buffer control register layout
| Bit(s) | Function |
|---|---|
| 31 | Buffer 1 full. Should be set to 1 by the processor for an IN transaction and 0 for an OUT transaction. The controller sets this to 1 for an OUT transaction because it has filled the buffer. The controller sets it to 0 for an IN transaction because it has emptied the buffer. Only valid when double buffering. |
| 30 | Last buffer of transfer for buffer 1. Only valid when double buffering. |
| 29 | Data PID for buffer 1 - DATA0 = 0, DATA1 = 1. Only valid when double buffering. |
| 27:28 | Double buffer offset for isochronous mode (0 = 128, 1 = 256, 2 = 512, 3 = 1024). |
| 26 | Buffer 1 available. Whether the buffer can be used by the controller for a transfer. The processor sets this to 1 when the buffer is configured. The controller sets this to 0 after it has sent the data to the host for an IN transaction, or filled the buffer with data from the host for an OUT transaction. Only valid when double buffering. |
| 25:16 | Buffer 1 transfer length. Only valid when double buffering. |
| 15 | Buffer 0 full. Should be set to 1 by the processor for an IN transaction and 0 for an OUT transaction. The controller sets this to 1 for an OUT transaction because it has filled the buffer. The controller sets it to 0 for an IN transaction because it has emptied the buffer. |
| 14 | Last buffer of transfer for buffer 0. |
| 13 | Data PID for buffer 0 - DATA0 = 0, DATA1 = 1. |
| 12 | Reset buffer select to buffer 0 - cleared at end of transfer. For device only . |
| 11 | Send STALL for device, STALL received for host. |
| 10 | Buffer 0 available. Indicates whether the buffer can be used by the controller for a transfer. The processor sets this to 1 when the buffer is configured. The controller sets this to 0 after it has sent the data to the host for an IN transaction or filled the buffer with data from the host for an OUT transaction. |
| 9:0 | Buffer 0 transfer length. |
WARNING
If you run clk_sys and clk_usb at different speeds, set the available and stall bits after the other data in the buffer control register. Otherwise, the controller may initiate a transaction with data from a previous packet. The controller could see the available bit set, but get the data PID or length from the previous packet.
12.7.3.8. Device controller
This section details how the device controller operates when it receives various packet types from the host.
12.7.3.8.1. SETUP
The device controller MUST always accept a SETUP packet from the host. DPSRAM dedicates its first 8 bytes to the setup packet.
The USB 2.0 Specification states that receiving a setup packet also clears any stall bits on EP0 . For this reason, the stall
bits for EP0 are gated with two bits in the EP_STALL_ARM register. These bits are cleared when a setup packet is received. This means that to send a stall on EP0 , you must set both the stall bit in the buffer control register and the appropriate bit in EP_STALL_ARM .
Barring any errors, the setup packet will be put into the setup packet buffer at DPSRAM offset 0x0 . The device controller will then reply with an ACK .
Finally, SIE_STATUS.SETUP_REC is set to indicate that a setup packet has been received. This will trigger an interrupt if the programmer has enabled the SETUP_REC interrupt (see INTE ).
12.7.3.8.2. IN
From the device's point of view, an IN transfer means transferring data into the host. When an IN token is received from the host, the request is handled as follows:
TOKEN phase:
- 1. If STALL is set in the buffer control register (and if EP0 , the appropriate EP_STALL_ARM bit is set), send a STALL response and go to idle.
- 2. If AVAILABLE and FULL bits are set in buffer control, go to the DATA phase.
- 3. If this is an isochronous endpoint, go to idle.
- ◦ Otherwise, send NAK and go to the DATA phase.
DATA phase:
- 1. Send data.
- 2. If this is an isochronous endpoint, go to idle.
- ◦ Otherwise, go to the ACK phase.
ACK phase:
- 1. Wait for ACK packet from host.
- 2. If there is a timeout, raise a timeout error.
- 3. If ACK is received, the packet is done, so go to STATUS phase.
STATUS phase:
- 1. If this was the last buffer in the transfer (i.e. if the LAST_BUFFER bit in the buffer control register was set), set SIE_STATUS.TRANS_COMPLETE .
- 2. If the endpoint is double buffered, flip the buffer select to the other buffer.
- 3. Set a bit in BUFF_STATUS to indicate the buffer is done. When handling this event, the programmer should read BUFF_CPU_SHOULD_HANDLE to see if it is buffer 0 or buffer 1 that is finished. If the endpoint is double-buffered, both buffers could be done. The cleared BUFF_STATUS bit will be set again, and BUFF_CPU_SHOULD_HANDLE will change in this instance.
- 4. Update status in the appropriate half of the buffer control register: length , pid , and last_buff are set. Everything else is written to zero.
If the host receives a NAK , the host will retry again later.
12.7.3.8.3. OUT
When an OUT token is received from the host, the request is handled as follows:
TOKEN phase:
- 1. If this is not an Isochronous endpoint and the data PID does not match the buffer control register, raise
SIE_STATUS.DATA_SEQ_ERROR (isochronous data is always sent with a DATA0 pid).
- 2. If the AVAILABLE bit is set and the FULL bit is clear, go to the DATA phase, unless the STALL bit is set in which case the device controller will reply with a STALL .
DATA phase:
- 1. Store received data in buffer. If this is an isochronous endpoint, go to the STATUS phase. Otherwise, go to the ACK phase.
ACK phase:
STATUS phase:
See IN STATUS phase: [usb-device-in-status-phase] . There is one difference: the FULL bit is set in the buffer control register to indicate that data has been received. In the IN phase, the FULL bit is cleared to indicate that data has been sent.
12.7.3.8.4. Suspend and resume
The USB device controller supports suspend, resume, and device-initiated remote resume (triggered with SIE_CTRL.RESUME ). There is an interrupt / status bit in SIE_STATUS . It is not necessary to enable the suspend and resume interrupts, since suspend and resume are irrelevant to most devices.
The device goes into suspend when it does not see any start of frame packets (transmitted every 1ms) from the host.
i NOTE
If you enable the suspend interrupt, it is likely you will see a suspend interrupt when the device first connects, but the bus is idle. The bus can be idle for a few milliseconds before the host begins sending start of frame packets. If you do not have a VBUS detect circuit connected, you will also see a suspend interrupt when the device disconnects. Without VBUS detection, it is impossible to tell the difference between being disconnected and suspended.
12.7.3.9. Host controller
The host controller design is similar to the device controller. The host starts all transactions, so the host always deals with transactions it has started. For this reason, there is only one set of endpoint control and endpoint buffer control registers. The host controller also contains additional hardware to poll interrupt endpoints in the background when there are no software controlled transactions taking place.
The host needs to send keep-alive packets to the device every 1ms to keep the device from suspending. Full Speed mode uses a SOF (start of frame) packet. Low Speed mode uses an EOP (end of packet) instead. Set SIE_CTRL.KEEP_ALIVE_EN and SIE_CTRL.SOF_EN to enable these packets.
Several bits in SIE_CTRL are used to begin a host transaction:
- • SEND_SETUP - Send a setup packet. Typically used with RECEIVE_TRANS , so the setup packet will be sent followed by the additional data transaction expected from the device.
- • SEND_TRANS - This transfer is OUT from the host.
- • RECEIVE_TRANS - This transfer is IN to the host.
- • START_TRANS - Start the transfer (non-latching).
- • STOP_TRANS - Stop the current transfer (non-latching).
- • PREAMBLE_ENABLE - Used to send a packet to a Low Speed device on a Full Speed hub. Sends a PRE token packet before every packet the host sends (i.e. PRE , TOKEN , PRE , DATA , pre , ACK ).
- • SOF_SYNC - Used to delay the transaction until after the next SOF . Useful for interrupt and isochronous endpoints. The host controller prevents a transaction of 64 bytes from clashing with the SOF packets. For longer isochronous
packets, software is responsible for preventing collisions. To prevent collisions in software, use
SOF_SYNC and limit the number of packets sent in one frame. If a transaction is set up with multiple packets,
SOF_SYNC only applies to the first packet.
The
START_TRANS bit is synchronised separately from other control bits in the
SIE_CTRL register because the processor clock
clk_sys can be asynchronous to the
clk_usb clock. Always set the
START_TRANS bit separately from the rest of the data in the
SIE_CTRL register. Always ensure that at least two
clk_usb cycles pass between writing to
START_TRANS and other bits in
SIE_CTRL. This ensures that the register contents are stable when the controller is prompted to start a transfer.
Consider a scenario where
clk_sys runs at 125MHz and
clk_usb runs at 48MHz. Because
\(
\lceil \frac{125}{48} \rceil \times 2 = 6
\)
, you should issue 6
nop instructions between the writes to guarantee that at least two
clk_usb cycles have passed.
12.7.3.9.1. SETUP
The
SETUP packet sent from the host always comes from the dedicated 8 bytes of space at offset
0x0 of the DPSRAM. Like the device controller, there are no control registers associated with the setup packet. The parameters are hard-coded and loaded into the hardware when you write to
START_TRANS with the
SEND_SETUP bit set. Once the setup packet has been sent, the host state machine waits for an
ACK from the device. If there is a timeout, an
RX_TIMEOUT error will be raised. If the
SEND_TRANS bit is set, the host state machine will move to the
OUT phase. Typically, the
SEND_SETUP packet is used with the
RECEIVE_TRANS bit, so the controller moves to the
IN phase after sending a setup packet.
12.7.3.9.2. IN
An
IN transfer is triggered with the
RECEIVE_TRANS bit set when the
START_TRANS bit is set. If the
SEND_SETUP bit was set, this may be preceded by a
SETUP packet.
CONTROL phase:
- 1. Read the
EPxcontrol register located at0x80to get the following endpoint information:- ◦ Is it double buffered?
- ◦ What interrupts are enabled?
- ◦ Base address of the data buffer (data buffers if in double-buffered mode)
- ◦ What is the endpoint type?
- 2. Read the
EPxbuffer control register at0x100to get endpoint buffer information, such as transfer length and data PID. - 3. Set the
AVAILABLEbit (the host state machine checks for it). - 4. Clear the
FULLbit.
TOKEN phase:
- 1. Send the
INtoken packet to the device. The target device address and endpoint come from theADDR_ENDPregister.
DATA phase:
- 1. Receive the first data packet from the device.
- 2. Raise RX timeout error if the device doesn't reply.
- 3. If this is
not
an Isochronous endpoint and the data PID does not match the buffer control register, raise
SIE_STATUS.DATA_SEQ_ERROR(isochronous data is always sent with aDATA0pid).
ACK phase:
- 1. Send
ACKto device.
STATUS phase:
- 1. Set the BUFF_STATUS bit and update the buffer control register.
- 2. Set FULL , DATA_PID , WR_LEN , and LAST_BUFF if applicable.
- 3. If this is the last buffer in the transfer, set TRANS_COMPLETE .
CONTROL phase (continued):
The host state machine performs IN transactions until LAST_BUFF is seen in the buffer_control register.
If the host is in double buffered mode, the host controller toggles between the BUF0 and BUF1 sections of the buffer control register.
Otherwise, the controller reads the buffer control register for buffer 0, then waits for FULL to be clear and AVAILABLE to be set before starting the next IN transaction, waiting in the CONTROL phase.
If the host receives a zero length packet, the device has no more data. The host state machine stops listening for more data regardless of if the LAST_BUFF flag was set or not. To detect this from host software, check BUFF_DONE for a data length of 0 in the buffer control register.
12.7.3.9.3. OUT
An OUT transfer is triggered with the SEND_TRANS bit set when the START_TRANS bit is set. This may be preceded by a SETUP packet if the SEND_SETUP bit was set.
CONTROL phase:
- 1. Read the EPx control register to get endpoint information (same as Section 12.7.3.9.2 ).
- 2. Read the EPx buffer control register to get the transfer length and data PID. AVAILABLE and FULL must be set before the transfer can start.
TOKEN phase
- 1. Send an OUT packet to the device. The target device address and endpoint come from the ADDR_ENDP register.
DATA phase:
- 1. Send the first data packet to the device. If the endpoint type is isochronous, there is no
ACK
phase, so the host controller goes straight to status phase. If
ACK
is received, go to status phase. Otherwise:
- ◦ If the host receives no reply, raise SIE_STATUS.RX_TIMEOUT .
- ◦ If the host receives NAK , raise SIE_STATUS.NAK_REC and send the data packet again.
- ◦ If the host receives STALL , raise SIE_STATUS.STALL_REC and go to idle.
STATUS phase:
- 1. Set the BUFF_STATUS bit and update the buffer control register. FULL will be set to 0. TRANS_COMPLETE will be set if this is the last buffer in the transfer.
CONTROL phase (continued):
- 1. If this isn't the last buffer in the transfer, wait for FULL and AVAILABLE to be set in the EPx buffer control register again.
12.7.3.9.4. Interrupt endpoints
The host controller can poll interrupt endpoints on a maximum of 15 endpoints. To enable interrupt endpoints, the programmer must:
- • Pick the next free interrupt endpoint slot on the host controller (starting at 1, to a maximum of 15).
- • Program the appropriate endpoint control register and buffer control register like you would with a normal IN or OUT transfer. Because interrupt endpoints are single-buffered, the BUF1 part of the buffer control register is invalid.
- • Set the address and endpoint of the device in the appropriate ADDR_ENDP register ( ADDR_ENDP1 to ADDR_ENDP15 ).
If the device is Low Speed but attached to a Full Speed hub, the preamble bit should be set. The endpoint direction bit should also be set.
- • Set the corresponding interrupt endpoint active bit (one of bits 1 through 15) in INT_EP_CTRL .
Typically, interrupt endpoints use an IN transfer. The host might poll a USB hub to see if the state of any of its ports have changed. If there is no change, the hub replies with a NAK to the controller, and nothing happens. Similarly, a mouse replies with a NAK unless the mouse has been moved since the last time the interrupt endpoint was polled.
Interrupt endpoints are polled by the controller once a SOF packet has been sent by the host controller.
The controller loops from 1 to 15 and attempts to poll any interrupt endpoint with the EP_ACTIVE bit set to 1 in INT_EP_CTRL . The controller will then read the endpoint control register and the buffer control register to see if there is an available buffer (i.e. FULL + AVAILABLE if an OUT transfer and NOT FULL + AVAILABLE for an IN transfer). If not, the controller will move onto the next interrupt endpoint slot.
If there is an available buffer, the transfer is dealt with the same as a normal IN or OUT transfer and the BUFF_DONE flag in BUFF_STATUS will be set when the interrupt endpoint has a valid buffer.
12.7.3.10. VBUS control
The USB controller can be connected to GPIO pins (see Chapter 9 ) for the following VBUS controls:
- • VBUS enable , used to enable VBUS in host mode. Set in SIE_CTRL .
- • VBUS detect , used to detect that VBUS is present in device mode. Set via a bit in SIE_STATUS . Can also raise a VBUS_DETECT interrupt enabled in INTE .
- • VBUS overcurrent , used to detect an overcurrent event. Applicable to both device and host. VBUS overcurrent is a bit in SIE_STATUS .
It is not necessary to connect up any of these pins to GPIO. The host can permanently supply VBUS and detect a device being connected when either the DP or DM pin is pulled high. VBUS detect can be forced in USB_PWR .
12.7.4. Programmer's model
12.7.4.1. TinyUSB
The RP2350 TinyUSB port is the reference implementation for this USB controller. This port can be found in the following files of the pico-sdk GitHub repository:
dcd_rp2040.c
hcd_rp2040.c
rp2040_usb.h
12.7.4.2. Standalone device example
A standalone USB device example, dev_lowlevel , makes it easier to understand how to interact with the USB controller without needing to understand the TinyUSB abstractions. In addition to endpoint 0, the standalone device has two bulk endpoints: EP1 OUT and EP2 IN . The device is designed to send whatever data it receives on EP1 to EP2 . The example comes with a small Python script that writes "Hello World" into EP1 and checks that it is correctly received on EP2 .
The code included in this section explains setting up the USB device controller to receive. It also shows how software responds to a setup packet received from the host.
Figure 125. USB analyser trace of the dev_lowlevel USB device example. The control transfers are the device enumeration. The first bulk OUT (out from the host) transfer, highlighted in blue, is the host sending "Hello World" to the device. The second bulk transfer IN (in to the host), is the device returning "Hello World" to the host.
| Ch0 | Packet 522 | H ↓ | Reset 15.006 ms |
|---|---|---|---|
| Transfer 0 | F S | Control GET | ADDR 0 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue DEVICE type | ||
| wIndex 0x0000 | Descriptors DEVICE Descriptor | ||
| Ch0 | Packet 646 | H ↓ | Reset 15.006 ms |
| Transfer 1 | F S | Control SET | ADDR 0 |
| ENDP 0 | |||
| bRequest SET_ADDRESS | wValue New address 7 | ||
| wIndex 0x0000 | wLength 0 | ||
| Transfer 2 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue DEVICE type | ||
| wIndex 0x0000 | Descriptors DEVICE Descriptor | ||
| Transfer 3 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue CONFIGURATION type, Index 0 | ||
| wIndex 0x0000 | Descriptors CONFIGURATION Descriptor | ||
| Transfer 4 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue CONFIGURATION type, Index 0 | ||
| wIndex 0x0000 | Descriptors 4 Descriptors | ||
| Transfer 5 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue STRING type, LANGID codes requested | ||
| wIndex Language ID 0x0000 | Descriptors Lang Supported | ||
| Transfer 6 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue STRING type, Index 2 | ||
| wIndex Language ID 0x0409 | Descriptors Pico Test Device | ||
| Transfer 7 | F S | Control GET | ADDR 7 |
| ENDP 0 | |||
| bRequest GET_DESCRIPTOR | wValue STRING type, Index 1 | ||
| wIndex Language ID 0x0409 | Descriptors Raspberry Pi | ||
| Transfer 8 | F S | Control SET | ADDR 7 |
| ENDP 0 | |||
| bRequest SET_CONFIGURATION | wValue New Configuration 1 | ||
| wIndex 0x0000 | wLength 0 | ||
| Transfer 9 | F S | Bulk OUT | ADDR 7 |
| ENDP 1 | Bytes Transferred 12 | ||
| Transfer 10 | F S | Bulk IN | ADDR 7 |
| ENDP 2 | Bytes Transferred 12 |
12.7.4.2.1. Device controller initialisation
The following code initialises the USB device:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 183 - 217
183 void usb_device_init() {
184 // Reset usb controller
185 reset_unreset_block_num_wait_blocking(RESET_USBCTRL);
186
187 // Clear any previous state in dpram just in case
188 memset(usb_dpram, 0, sizeof(*usb_dpram)); ①
189
190 // Enable USB interrupt at processor
191 irq_set_enabled(USBCTRL_IRQ, true);
192
193 // Mux the controller to the onboard usb phy
194 usb_hw->muxing = USB_USB_MUXING_TO_PHY_BITS | USB_USB_MUXING_SOFTCON_BITS;
195
196 // Force VBUS detect so the device thinks it is plugged into a host
197 usb_hw->pwr = USB_USB_PWR_VBUS_DETECT_BITS | USB_USB_PWR_VBUS_DETECT_OVERRIDE_EN_BITS;
198
199 // Enable the USB controller in device mode.
200 usb_hw->main_ctrl = USB_MAIN_CTRL_CONTROLLER_EN_BITS;
201
202 // Enable an interrupt per EP0 transaction
203 usb_hw->sie_ctrl = USB_SIE_CTRL_EP0_INT_1BUF_BITS; ②
204
205 // Enable interrupts for when a buffer is done, when the bus is reset,
206 // and when a setup packet is received
207 usb_hw->inte = USB_INTS_BUFF_STATUS_BITS |
208 USB_INTS_BUS_RESET_BITS |
209 USB_INTS_SETUP_REQ_BITS;
210
211 // Set up endpoints (endpoint control registers)
212 // described by device configuration
213 usb_setup_endpoints();
214
215 // Present full speed device by enabling pull up on DP
216 usb_hw_set->sie_ctrl = USB_SIE_CTRL_PULLUP_EN_BITS; 217 }
12.7.4.2.2. Configuring the endpoint control registers for EP1 and EP2
The function
usb_configure_endpoints loops through each endpoint defined in the device configuration (including EP0 in and EP0 out, which don't have an endpoint control register defined) and calls the
usb_configure_endpoint function. This sets up the endpoint control register for that endpoint:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 149 - 164
149 void usb_setup_endpoint(const struct usb_endpoint_configuration *ep) {
150 printf("Set up endpoint 0x%x with buffer address 0x%p\n", ep->descriptor-
>bEndpointAddress, ep->data_buffer);
151
152 // EP0 doesn't have one so return if that is the case
153 if (!ep->endpoint_control) {
154 return;
155 }
156
157 // Get the data buffer as an offset of the USB controller's DPRAM
158 uint32_t dpram_offset = usb_buffer_offset(ep->data_buffer);
159 uint32_t reg = EP_CTRL_ENABLE_BITS
160 | EP_CTRL_INTERRUPT_PER_BUFFER
161 | (ep->descriptor->bmAttributes << EP_CTRL_BUFFER_TYPE_LSB)
162 | dpram_offset;
163 *ep->endpoint_control = reg;
164 }
12.7.4.2.3. Receiving a setup packet
An interrupt is raised when a setup packet is received, so the interrupt handler must handle this event:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 494 - 504
494 void isr_usbctrl(void) {
495 // USB interrupt handler
496 uint32_t status = usb_hw->ints;
497 uint32_t handled = 0;
498
499 // Setup packet received
500 if (status & USB_INTS_SETUP_REQ_BITS) {
501 handled |= USB_INTS_SETUP_REQ_BITS;
502 usb_hw_clear->sie_status = USB_SIE_STATUS_SETUP_REC_BITS;
503 usb_handle_setup_packet();
504 }
The controller writes the
SETUP packet to the first 8 bytes of the DPSRAM, so the setup packet handler casts that area of memory to
struct usb_setup_packet *:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 383 - 427
383 void usb_handle_setup_packet(void) {
384 volatile struct usb_setup_packet *pkt = (volatile struct usb_setup_packet *) &usb_dpram
->setup_packet;
385 uint8_t req_direction = pkt->bmRequestType;
386 uint8_t req = pkt->bRequest;
387
388 // Reset PID to 1 for EP0 IN
389 usb_get_endpoint_configuration(EP0_IN_ADDR)->next_pid = 1u;
390
391 if (req_direction == USB_DIR_OUT) {
392 if (req == USB_REQUEST_SET_ADDRESS) {
393 usb_set_device_address(pkt);
394 } else if (req == USB_REQUEST_SET_CONFIGURATION) {
395 usb_set_device_configuration(pkt);
396 } else {
397 usb_acknowledge_out_request();
398 printf("Other OUT request (0x%x)\r\n", pkt->bRequest);
399 }
400 } else if (req_direction == USB_DIR_IN) {
401 if (req == USB_REQUEST_GET_DESCRIPTOR) {
402 uint16_t descriptor_type = pkt->wValue >> 8;
403
404 switch (descriptor_type) {
405 case USB_DT_DEVICE:
406 usb_handle_device_descriptor(pkt);
407 printf("GET DEVICE DESCRIPTOR\r\n");
408 break;
409
410 case USB_DT_CONFIG:
411 usb_handle_config_descriptor(pkt);
412 printf("GET CONFIG DESCRIPTOR\r\n");
413 break;
414
415 case USB_DT_STRING:
416 usb_handle_string_descriptor(pkt);
417 printf("GET STRING DESCRIPTOR\r\n");
418 break;
419
420 default:
421 printf("Unhandled GET_DESCRIPTOR type 0x%x\r\n", descriptor_type);
422 }
423 } else {
424 printf("Other IN request (0x%x)\r\n", pkt->bRequest);
425 }
426 }
427 }
12.7.4.2.4. Replying to a setup packet on EP0 IN
The host first requests the device descriptor. The following code handles that setup request:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 266 - 273
266 void usb_handle_device_descriptor(volatile struct usb_setup_packet *pkt) {
267 const struct usb_device_descriptor *d = dev_config.device_descriptor;
268 // EP0 in
269 struct usb_endpoint_configuration *ep = usb_get_endpoint_configuration(EP0_IN_ADDR);
270 // Always respond with pid 1
271 ep->next_pid = 1;
272 usb_start_transfer(ep, (uint8_t *) d, MIN(sizeof(struct usb_device_descriptor), pkt->wLength));
273 }
The
usb_start_transfer function copies data to be sent into the appropriate hardware buffer and configures the buffer
control register. Once the buffer control register has been written to, the device controller responds to the host with the data. Before this point, the device replies with a NAK :
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 238 - 260
238 void usb_start_transfer(struct usb_endpoint_configuration *ep, uint8_t *buf, uint16_t len) {
239 // We are asserting that the length is <= 64 bytes for simplicity of the example.
240 // For multi packet transfers see the tinyusb port.
241 assert(len <= 64);
242
243 printf("Start transfer of len %d on ep addr 0x%x\n", len, ep->descriptor-
>bEndpointAddress);
244
245 // Prepare buffer control register value
246 uint32_t val = len | USB_BUF_CTRL_AVAIL;
247
248 if (ep_is_tx(ep)) {
249 // Need to copy the data from the user buffer to the usb memory
250 memcpy((void *) ep->data_buffer, (void *) buf, len);
251 // Mark as full
252 val |= USB_BUF_CTRL_FULL;
253 }
254
255 // Set pid and flip for next transfer
256 val |= ep->next_pid ? USB_BUF_CTRL_DATA1_PID : USB_BUF_CTRL_DATA0_PID;
257 ep->next_pid ^= 1u;
258
259 *ep->buffer_control = val;
260 }12.7.5. List of registers
The USB registers start at a base address of 0x50110000 (defined as USBCTRL_REGS_BASE in SDK).
Table 1195. List of USB registers
| Offset 0x42fc8 0x42fcc 0x42fd0 0x42fd4 0x42fd8 | Name DEVID DEVTYPE PIDR4 PIDR5 PIDR6 | Info Device Configuration register Device Type Identifier register CoreSight Periperal ID4 CoreSight Periperal ID5 CoreSight Periperal ID6 |
|---|---|---|
| Pico Examples: | https://github.com/raspberrypi/pico-examples/blob/master/usb/device/dev_lowlevel/dev_lowlevel.c Lines 238 - 260 | |
| 241 | assert(len <= 64); | |
| 243 | printf("Start transfer of len %d on ep addr 0x%x\n", len, ep->descriptor- | |
| 246 | uint32_t | // Prepare buffer control register value val = len | USB_BUF_CTRL_AVAIL; |
| 248 | if (ep_is_tx(ep)) { | |
| 250 | memcpy((void | *) ep->data_buffer, (void *) buf, len); |
| 251 | // Mark as full | |
| 252 | // Mark as full val | |= USB_BUF_CTRL_FULL; |
| 253 | } | |
| 255 | } // Set pid and flip for next transfer | |
| 256 | // Set pid and flip for next transfer val | |= ep->next_pid ? USB_BUF_CTRL_DATA1_PID : USB_BUF_CTRL_DATA0_PID; |
| 257 | ep->next_pid ^= 1u; | |
| 259 260 } | *ep->buffer_control | = val; |
| 12.7.5. List of registers The USB registers start at a base address of | 0x50110000 (defined as USBCTRL_REGS_BASE in SDK). | |
| Table 1195. List of Offset | Name | Info |
| USB registers 0x000 | ADDR_ENDP | Device address and endpoint control |
| 0x004 | ADDR_ENDP1 | Interrupt endpoint 1. Only valid for HOST mode. |
| 0x008 | ADDR_ENDP2 | Interrupt endpoint 2. Only valid for HOST mode. |
| 0x00c | ADDR_ENDP3 | Interrupt endpoint 3. Only valid for HOST mode. |
| 0x010 | ADDR_ENDP4 | Interrupt endpoint 4. Only valid for HOST mode. |
| 0x014 | ADDR_ENDP5 | Interrupt endpoint 5. Only valid for HOST mode. |
| 0x018 | ADDR_ENDP6 | Interrupt endpoint 6. Only valid for HOST mode. |
| 0x01c | ADDR_ENDP7 | Interrupt endpoint 7. Only valid for HOST mode. |
| 0x020 | ADDR_ENDP8 | Interrupt endpoint 8. Only valid for HOST mode. |
| 0x024 | ADDR_ENDP9 | Interrupt endpoint 9. Only valid for HOST mode. |
| 0x028 | ADDR_ENDP10 | Interrupt endpoint 10. Only valid for HOST mode. |
| 0x02c | ADDR_ENDP11 | Interrupt endpoint 11. Only valid for HOST mode. |
| 0x030 | ADDR_ENDP12 | Interrupt endpoint 12. Only valid for HOST mode. |
| 0x034 | ADDR_ENDP13 | Interrupt endpoint 13. Only valid for HOST mode. |
| Offset | Name | Info |
|---|---|---|
| 0x038 | ADDR_ENDP14 | Interrupt endpoint 14. Only valid for HOST mode. |
| 0x03c | ADDR_ENDP15 | Interrupt endpoint 15. Only valid for HOST mode. |
| 0x040 | MAIN_CTRL | Main control register |
| 0x044 | SOF_WR | Set the SOF (Start of Frame) frame number in the host controller. The SOF packet is sent every 1ms and the host will increment the frame number by 1 each time. |
| 0x048 | SOF_RD | Read the last SOF (Start of Frame) frame number seen. In device mode the last SOF received from the host. In host mode the last SOF sent by the host. |
| 0x04c | SIE_CTRL | SIE control register |
| 0x050 | SIE_STATUS | SIE status register |
| 0x054 | INT_EP_CTRL | interrupt endpoint control register |
| 0x058 | BUFF_STATUS | Buffer status register. A bit set here indicates that a buffer has completed on the endpoint (if the buffer interrupt is enabled). It is possible for 2 buffers to be completed, so clearing the buffer status bit may instantly re set it on the next clock cycle. |
| 0x05c | BUFF_CPU_SHOULD_HANDLE | Which of the double buffers should be handled. Only valid if using an interrupt per buffer (i.e. not per 2 buffers). Not valid for host interrupt endpoint polling because they are only single buffered. |
| 0x060 | EP_ABORT | Device only: Can be set to ignore the buffer control register for this endpoint in case you would like to revoke a buffer. A NAK will be sent for every access to the endpoint until this bit is cleared. A corresponding bit in EP_ABORT_DONE is set when it is safe to modify the buffer control register. |
| 0x064 | EP_ABORT_DONE | Device only: Used in conjunction with EP_ABORT . Set once an endpoint is idle so the programmer knows it is safe to modify the buffer control register. |
| 0x068 | EP_STALL_ARM | Device: this bit must be set in conjunction with the STALL bit in the buffer control register to send a STALL on EP0. The device controller clears these bits when a SETUP packet is received because the USB spec requires that a STALL condition is cleared when a SETUP packet is received. |
| 0x06c | NAK_POLL | Used by the host controller. Sets the wait time in microseconds before trying again if the device replies with a NAK. |
| 0x070 | EP_STATUS_STALL_NAK | Device: bits are set when the IRQ_ON_NAK or IRQ_ON_STALL bits are set. For EP0 this comes from SIE_CTRL . For all other endpoints it comes from the endpoint control register. |
| 0x074 | USB_MUXING | Where to connect the USB controller. Should be to_phy by default. |
| 0x078 | USB_PWR | Overrides for the power signals in the event that the VBUS signals are not hooked up to GPIO. Set the value of the override and then the override enable to switch over to the override value. |
| Offset | Name | Info |
|---|---|---|
| 0x07c | USBPHY_DIRECT | This register allows for direct control of the USB phy. Use in conjunction with
usbphy_direct_override register to enable each override bit. |
| 0x080 | USBPHY_DIRECT_OVERRIDE | Override enable for each control in
usbphy_direct |
| 0x084 | USBPHY_TRIM | Used to adjust trim values of USB phy pull down resistors. |
| 0x088 | LINESTATE_TUNING | Used for debug only. |
| 0x08c | INTR | Raw Interrupts |
| 0x090 | INTE | Interrupt Enable |
| 0x094 | INTF | Interrupt Force |
| 0x098 | INTS | Interrupt status after masking & forcing |
| 0x100 | SOF_TIMESTAMP_RAW | Device only. Raw value of free-running PHY clock counter @48MHz. Used to calculate time between SOF events. |
| 0x104 | SOF_TIMESTAMP_LAST | Device only. Value of free-running PHY clock counter @48MHz when last SOF event occurred. |
| 0x108 | SM_STATE | |
| 0x10c | EP_TX_ERROR | TX error count for each endpoint. Write to each field to reset the counter to 0. |
| 0x110 | EP_RX_ERROR | RX error count for each endpoint. Write to each field to reset the counter to 0. |
| 0x114 | DEV_SM_WATCHDOG | Watchdog that forces the device state machine to idle and raises an interrupt if the device stays in a state that isn't idle for the configured limit. The counter is reset on every state transition. Set limit while enable is low and then set the enable. |
USB: ADDR_ENDP Register
Offset: 0x000
Description
Device address and endpoint control
Table 1196.
ADDR_ENDP Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:20 | Reserved. | - | - |
| 19:16 | ENDPOINT: Device endpoint to send data to. Only valid for HOST mode. | RW | 0x0 |
| 15:7 | Reserved. | - | - |
| 6:0 | ADDRESS: In device mode, the address that the device should respond to. Set in response to a SET_ADDR setup packet from the host. In host mode set to the address of the device to communicate with. | RW | 0x00 |
USB: ADDR_ENDP1, ADDR_ENDP2, ..., ADDR_ENDP14, ADDR_ENDP15 Registers
Offsets: 0x004, 0x008, ..., 0x038, 0x03c
Description
Interrupt endpoint N . Only valid for HOST mode.
Table 1197.
ADDR_ENDP1,
ADDR_ENDP2, ...,
ADDR_ENDP14,
ADDR_ENDP15
Registers
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:27 | Reserved. | - | - |
| 26 | INTEP_PREAMBLE : Interrupt EP requires preamble (is a low speed device on a full speed hub) | RW | 0x0 |
| 25 | INTEP_DIR : Direction of the interrupt endpoint. In=0, Out=1 | RW | 0x0 |
| 24:20 | Reserved. | - | - |
| 19:16 | ENDPOINT : Endpoint number of the interrupt endpoint | RW | 0x0 |
| 15:7 | Reserved. | - | - |
| 6:0 | ADDRESS : Device address | RW | 0x00 |
USB: MAIN_CTRL Register
Offset: 0x040
Description
Main control register
Table 1198.
MAIN_CTRL Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | SIM_TIMING : Reduced timings for simulation | RW | 0x0 |
| 30:3 | Reserved. | - | - |
| 2 | PHY_ISO
: Isolates USB phy after controller power-up Remove isolation once software has configured the controller Not isolated = 0, Isolated = 1 | RW | 0x1 |
| 1 | HOST_NDEVICE : Device mode = 0, Host mode = 1 | RW | 0x0 |
| 0 | CONTROLLER_EN : Enable controller | RW | 0x0 |
USB: SOF_WR Register
Offset: 0x044
Description
Set the SOF (Start of Frame) frame number in the host controller. The SOF packet is sent every 1ms and the host will increment the frame number by 1 each time.
Table 1199. SOF_WR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:11 | Reserved. | - | - |
| 10:0 | COUNT | WF | 0x000 |
USB: SOF_RD Register
Offset: 0x048
Description
Read the last SOF (Start of Frame) frame number seen. In device mode the last SOF received from the host. In host mode the last SOF sent by the host.
Table 1200. SOF_RD Register| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:11 | Reserved. | - | - |
| 10:0 | COUNT | RO | 0x000 |
USB: SIE_CTRL Register
Offset: 0x04c
Description
SIE control register
Table 1201. SIE_CTRL Register| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP0_INT_STALL : Device: Set bit in EP_STATUS_STALL_NAK when EP0 sends a STALL | RW | 0x0 |
| 30 | EP0_DOUBLE_BUF : Device: EP0 single buffered = 0, double buffered = 1 | RW | 0x0 |
| 29 | EP0_INT_1BUF : Device: Set bit in BUFF_STATUS for every buffer completed on EP0 | RW | 0x0 |
| 28 | EP0_INT_2BUF : Device: Set bit in BUFF_STATUS for every 2 buffers completed on EP0 | RW | 0x0 |
| 27 | EP0_INT_NAK : Device: Set bit in EP_STATUS_STALL_NAK when EP0 sends a NAK | RW | 0x0 |
| 26 | DIRECT_EN : Direct bus drive enable | RW | 0x0 |
| 25 | DIRECT_DP : Direct control of DP | RW | 0x0 |
| 24 | DIRECT_DM : Direct control of DM | RW | 0x0 |
| 23:20 | Reserved. | - | - |
| 19 | EP0_STOP_ON_SHORT_PACKET : Device: Stop EP0 on a short packet. | RW | 0x0 |
| 18 | TRANSCEIVER_PD : Power down bus transceiver | RW | 0x0 |
| 17 | RPU_OPT : Device: Pull-up strength (0=1K2, 1=2k3) | RW | 0x0 |
| 16 | PULLUP_EN : Device: Enable pull up resistor | RW | 0x0 |
| 15 | PULLDOWN_EN : Host: Enable pull down resistors | RW | 0x1 |
| 14 | Reserved. | - | - |
| 13 | RESET_BUS : Host: Reset bus | SC | 0x0 |
| 12 | RESUME : Device: Remote wakeup. Device can initiate its own resume after suspend. | SC | 0x0 |
| 11 | VBUS_EN : Host: Enable VBUS | RW | 0x0 |
| 10 | KEEP_ALIVE_EN : Host: Enable keep alive packet (for low speed bus) | RW | 0x0 |
| 9 | SOF_EN : Host: Enable SOF generation (for full speed bus) | RW | 0x0 |
| 8 | SOF_SYNC : Host: Delay packet(s) until after SOF | RW | 0x0 |
| 7 | Reserved. | - | - |
| 6 | PREAMBLE_EN : Host: Preable enable for LS device on FS hub | RW | 0x0 |
| 5 | Reserved. | - | - |
| 4 | STOP_TRANS : Host: Stop transaction | SC | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 3 | RECEIVE_DATA : Host: Receive transaction (IN to host) | RW | 0x0 |
| 2 | SEND_DATA : Host: Send transaction (OUT from host) | RW | 0x0 |
| 1 | SEND_SETUP : Host: Send Setup packet | RW | 0x0 |
| 0 | START_TRANS : Host: Start transaction | SC | 0x0 |
USB: SIE_STATUS Register
Offset: 0x050
Description
SIE status register
Table 1202.
SIE_STATUS Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | DATA_SEQ_ERROR
: Data Sequence Error. The device can raise a sequence error in the following conditions: * A SETUP packet is received followed by a DATA1 packet (data phase should always be DATA0) * An OUT packet is received from the host but doesn't match the data pid in the buffer control register read from DPSRAM The host can raise a data sequence error in the following conditions: * An IN packet from the device has the wrong data PID | WC | 0x0 |
| 30 | ACK_REC : ACK received. Raised by both host and device. | WC | 0x0 |
| 29 | STALL_REC : Host: STALL received | WC | 0x0 |
| 28 | NAK_REC : Host: NAK received | WC | 0x0 |
| 27 | RX_TIMEOUT : RX timeout is raised by both the host and device if an ACK is not received in the maximum time specified by the USB spec. | WC | 0x0 |
| 26 | RX_OVERFLOW : RX overflow is raised by the Serial RX engine if the incoming data is too fast. | WC | 0x0 |
| 25 | BIT_STUFF_ERROR : Bit Stuff Error. Raised by the Serial RX engine. | WC | 0x0 |
| 24 | CRC_ERROR : CRC Error. Raised by the Serial RX engine. | WC | 0x0 |
| 23 | ENDPOINT_ERROR : An endpoint has encountered an error. Read the ep_rx_error and ep_tx_error registers to find out which endpoint had an error. | WC | 0x0 |
| 22:20 | Reserved. | - | - |
| 19 | BUS_RESET : Device: bus reset received | WC | 0x0 |
| Bits 14:10 9:5 4:0 Bits | Description SHIFT Description | MASK_MSB : The most-significant bit allowed to pass by the mask (inclusive) MASK_LSB : The least-significant bit allowed to pass by the mask (inclusive) : Right-rotate applied to accumulator before masking. By appropriately | Type RW RW RW Type | Reset 0x00 0x00 0x00 Reset |
|---|---|---|---|---|
| 15:13 | Reserved. | - | - | |
| 12 | RX_SHORT_PACKET | : Device or Host has received a short packet. This is when | WC | 0x0 |
| 11 | RESUME | registers. Host: the current transfer will be stopped early. : Host: Device has initiated a remote resume. Device: host has | WC | 0x0 |
| 10 | VBUS_OVER_CURR | initiated a resume. : VBUS over current detected | RO | 0x0 |
| 9:8 | SPEED | : Host: device speed. Disconnected = 00, LS = 01, FS = 10 | RO | 0x0 |
| 7:5 | Reserved. | - | - | |
| 4 | SUSPENDED | : Bus in suspended state. Valid for device and host. Host and | RO | 0x0 |
| 3:2 | LINE_STATE | device will go into suspend if neither Keep Alive / SOF frames are enabled. : USB bus line state | RO | 0x0 |
| 1 | Reserved. | - | - | |
| 0 | VBUS_DETECTED | : Device: VBUS Detected | RO | 0x0 |
| Table 1203. Bits | Description | Type | Reset | |
| INT_EP_CTRL Register 31:16 | Reserved. | - | - | |
| 15:1 | INT_EP_ACTIVE | : Host: Enable interrupt endpoint 1 | → 15 RW | 0x0000 |
| 0 | Reserved. | - | - |
USB: INT_EP_CTRL Register
Offset: 0x054
Description
interrupt endpoint control register
Table 1203.
INT_EP_CTRL Register
USB: BUFF_STATUS Register
Offset: 0x058 DescriptionBuffer status register. A bit set here indicates that a buffer has completed on the endpoint (if the buffer interrupt is enabled). It is possible for 2 buffers to be completed, so clearing the buffer status bit may instantly re set it on the next clock cycle.
Table 1204.
BUFF_STATUS
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_OUT | WC | 0x0 |
| 30 | EP15_IN | WC | 0x0 |
| 29 | EP14_OUT | WC | 0x0 |
| 28 | EP14_IN | WC | 0x0 |
| 27 | EP13_OUT | WC | 0x0 |
| 26 | EP13_IN | WC | 0x0 |
| 25 | EP12_OUT | WC | 0x0 |
| 24 | EP12_IN | WC | 0x0 |
| 23 | EP11_OUT | WC | 0x0 |
| 22 | EP11_IN | WC | 0x0 |
| 21 | EP10_OUT | WC | 0x0 |
| 20 | EP10_IN | WC | 0x0 |
| 19 | EP9_OUT | WC | 0x0 |
| 18 | EP9_IN | WC | 0x0 |
| 17 | EP8_OUT | WC | 0x0 |
| 16 | EP8_IN | WC | 0x0 |
| 15 | EP7_OUT | WC | 0x0 |
| 14 | EP7_IN | WC | 0x0 |
| 13 | EP6_OUT | WC | 0x0 |
| 12 | EP6_IN | WC | 0x0 |
| 11 | EP5_OUT | WC | 0x0 |
| 10 | EP5_IN | WC | 0x0 |
| 9 | EP4_OUT | WC | 0x0 |
| 8 | EP4_IN | WC | 0x0 |
| 7 | EP3_OUT | WC | 0x0 |
| 6 | EP3_IN | WC | 0x0 |
| 5 | EP2_OUT | WC | 0x0 |
| 4 | EP2_IN | WC | 0x0 |
| 3 | EP1_OUT | WC | 0x0 |
| 2 | EP1_IN | WC | 0x0 |
| 1 | EP0_OUT | WC | 0x0 |
| 0 | EP0_IN | WC | 0x0 |
USB: BUFF_CPU_SHOULD_HANDLE Register
Offset: 0x05c
Description
Which of the double buffers should be handled. Only valid if using an interrupt per buffer (i.e. not per 2 buffers). Not valid for host interrupt endpoint polling because they are only single buffered.
Table 1205.
BUFF_CPU_SHOULD_H
ANDLE Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_OUT | RO | 0x0 |
| 30 | EP15_IN | RO | 0x0 |
| 29 | EP14_OUT | RO | 0x0 |
| 28 | EP14_IN | RO | 0x0 |
| 27 | EP13_OUT | RO | 0x0 |
| 26 | EP13_IN | RO | 0x0 |
| 25 | EP12_OUT | RO | 0x0 |
| 24 | EP12_IN | RO | 0x0 |
| 23 | EP11_OUT | RO | 0x0 |
| 22 | EP11_IN | RO | 0x0 |
| 21 | EP10_OUT | RO | 0x0 |
| 20 | EP10_IN | RO | 0x0 |
| 19 | EP9_OUT | RO | 0x0 |
| 18 | EP9_IN | RO | 0x0 |
| 17 | EP8_OUT | RO | 0x0 |
| 16 | EP8_IN | RO | 0x0 |
| 15 | EP7_OUT | RO | 0x0 |
| 14 | EP7_IN | RO | 0x0 |
| 13 | EP6_OUT | RO | 0x0 |
| 12 | EP6_IN | RO | 0x0 |
| 11 | EP5_OUT | RO | 0x0 |
| 10 | EP5_IN | RO | 0x0 |
| 9 | EP4_OUT | RO | 0x0 |
| 8 | EP4_IN | RO | 0x0 |
| 7 | EP3_OUT | RO | 0x0 |
| 6 | EP3_IN | RO | 0x0 |
| 5 | EP2_OUT | RO | 0x0 |
| 4 | EP2_IN | RO | 0x0 |
| 3 | EP1_OUT | RO | 0x0 |
| 2 | EP1_IN | RO | 0x0 |
| 1 | EP0_OUT | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0 | EP0_IN | RO | 0x0 |
USB: EP_ABORT Register
Offset: 0x060
Description
Device only: Can be set to ignore the buffer control register for this endpoint in case you would like to revoke a buffer. A NAK will be sent for every access to the endpoint until this bit is cleared. A corresponding bit in EP_ABORT_DONE is set when it is safe to modify the buffer control register.
Table 1206.
EP_ABORT Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_OUT | RW | 0x0 |
| 30 | EP15_IN | RW | 0x0 |
| 29 | EP14_OUT | RW | 0x0 |
| 28 | EP14_IN | RW | 0x0 |
| 27 | EP13_OUT | RW | 0x0 |
| 26 | EP13_IN | RW | 0x0 |
| 25 | EP12_OUT | RW | 0x0 |
| 24 | EP12_IN | RW | 0x0 |
| 23 | EP11_OUT | RW | 0x0 |
| 22 | EP11_IN | RW | 0x0 |
| 21 | EP10_OUT | RW | 0x0 |
| 20 | EP10_IN | RW | 0x0 |
| 19 | EP9_OUT | RW | 0x0 |
| 18 | EP9_IN | RW | 0x0 |
| 17 | EP8_OUT | RW | 0x0 |
| 16 | EP8_IN | RW | 0x0 |
| 15 | EP7_OUT | RW | 0x0 |
| 14 | EP7_IN | RW | 0x0 |
| 13 | EP6_OUT | RW | 0x0 |
| 12 | EP6_IN | RW | 0x0 |
| 11 | EP5_OUT | RW | 0x0 |
| 10 | EP5_IN | RW | 0x0 |
| 9 | EP4_OUT | RW | 0x0 |
| 8 | EP4_IN | RW | 0x0 |
| 7 | EP3_OUT | RW | 0x0 |
| 6 | EP3_IN | RW | 0x0 |
| 5 | EP2_OUT | RW | 0x0 |
| 4 | EP2_IN | RW | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 3 | EP1_OUT | RW | 0x0 |
| 2 | EP1_IN | RW | 0x0 |
| 1 | EP0_OUT | RW | 0x0 |
| 0 | EP0_IN | RW | 0x0 |
USB: EP_ABORT_DONE Register
Offset: 0x064
Description
Device only: Used in conjunction with EP_ABORT . Set once an endpoint is idle so the programmer knows it is safe to modify the buffer control register.
Table 1207.
EP_ABORT_DONE
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_OUT | WC | 0x0 |
| 30 | EP15_IN | WC | 0x0 |
| 29 | EP14_OUT | WC | 0x0 |
| 28 | EP14_IN | WC | 0x0 |
| 27 | EP13_OUT | WC | 0x0 |
| 26 | EP13_IN | WC | 0x0 |
| 25 | EP12_OUT | WC | 0x0 |
| 24 | EP12_IN | WC | 0x0 |
| 23 | EP11_OUT | WC | 0x0 |
| 22 | EP11_IN | WC | 0x0 |
| 21 | EP10_OUT | WC | 0x0 |
| 20 | EP10_IN | WC | 0x0 |
| 19 | EP9_OUT | WC | 0x0 |
| 18 | EP9_IN | WC | 0x0 |
| 17 | EP8_OUT | WC | 0x0 |
| 16 | EP8_IN | WC | 0x0 |
| 15 | EP7_OUT | WC | 0x0 |
| 14 | EP7_IN | WC | 0x0 |
| 13 | EP6_OUT | WC | 0x0 |
| 12 | EP6_IN | WC | 0x0 |
| 11 | EP5_OUT | WC | 0x0 |
| 10 | EP5_IN | WC | 0x0 |
| 9 | EP4_OUT | WC | 0x0 |
| 8 | EP4_IN | WC | 0x0 |
| 7 | EP3_OUT | WC | 0x0 |
| 6 | EP3_IN | WC | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 5 | EP2_OUT | WC | 0x0 |
| 4 | EP2_IN | WC | 0x0 |
| 3 | EP1_OUT | WC | 0x0 |
| 2 | EP1_IN | WC | 0x0 |
| 1 | EP0_OUT | WC | 0x0 |
| 0 | EP0_IN | WC | 0x0 |
USB: EP_STALL_ARM Register
Offset: 0x068
Description
Device: this bit must be set in conjunction with the STALL bit in the buffer control register to send a STALL on EP0. The device controller clears these bits when a SETUP packet is received because the USB spec requires that a STALL condition is cleared when a SETUP packet is received.
Table 1208.
EP_STALL_ARM
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:2 | Reserved. | - | - |
| 1 | EP0_OUT | RW | 0x0 |
| 0 | EP0_IN | RW | 0x0 |
USB: NAK_POLL Register
Offset: 0x06c
Description
Used by the host controller. Sets the wait time in microseconds before trying again if the device replies with a NAK.
Table 1209.
NAK_POLL Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:28 | RETRY_COUNT_HI: Bits 9:6 of nak_retry count | RO | 0x0 |
| 27 | EPX_STOPPED_ON_NAK: EPX polling has stopped because a nak was received | WC | 0x0 |
| 26 | STOP_EPX_ON_NAK: Stop polling epX when a nak is received | RW | 0x0 |
| 25:16 | DELAY_FS: NAK polling interval for a full speed device | RW | 0x010 |
| 15:10 | RETRY_COUNT_LO: Bits 5:0 of nak_retry_count | RO | 0x00 |
| 9:0 | DELAY_LS: NAK polling interval for a low speed device | RW | 0x010 |
USB: EP_STATUS_STALL_NAK Register
Offset: 0x070
Description
Device: bits are set when the IRQ_ON_NAK or IRQ_ON_STALL bits are set. For EP0 this comes from SIE_CTRL . For all other endpoints it comes from the endpoint control register.
Table 1210.
EP_STATUS_STALL_NAK
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_OUT | WC | 0x0 |
| 30 | EP15_IN | WC | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 29 | EP14_OUT | WC | 0x0 |
| 28 | EP14_IN | WC | 0x0 |
| 27 | EP13_OUT | WC | 0x0 |
| 26 | EP13_IN | WC | 0x0 |
| 25 | EP12_OUT | WC | 0x0 |
| 24 | EP12_IN | WC | 0x0 |
| 23 | EP11_OUT | WC | 0x0 |
| 22 | EP11_IN | WC | 0x0 |
| 21 | EP10_OUT | WC | 0x0 |
| 20 | EP10_IN | WC | 0x0 |
| 19 | EP9_OUT | WC | 0x0 |
| 18 | EP9_IN | WC | 0x0 |
| 17 | EP8_OUT | WC | 0x0 |
| 16 | EP8_IN | WC | 0x0 |
| 15 | EP7_OUT | WC | 0x0 |
| 14 | EP7_IN | WC | 0x0 |
| 13 | EP6_OUT | WC | 0x0 |
| 12 | EP6_IN | WC | 0x0 |
| 11 | EP5_OUT | WC | 0x0 |
| 10 | EP5_IN | WC | 0x0 |
| 9 | EP4_OUT | WC | 0x0 |
| 8 | EP4_IN | WC | 0x0 |
| 7 | EP3_OUT | WC | 0x0 |
| 6 | EP3_IN | WC | 0x0 |
| 5 | EP2_OUT | WC | 0x0 |
| 4 | EP2_IN | WC | 0x0 |
| 3 | EP1_OUT | WC | 0x0 |
| 2 | EP1_IN | WC | 0x0 |
| 1 | EP0_OUT | WC | 0x0 |
| 0 | EP0_IN | WC | 0x0 |
USB: USB_MUXING Register
Offset: 0x074
Description
Where to connect the USB controller. Should be to_phy by default.
Table 1211.
USB_MUXING Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | SWAP_DPDM : Swap the USB PHY DP and DM pins and all related controls and flip receive differential data. Can be used to switch USB DP/DP on the PCB. This is done at a low level so overrides all other controls. | RW | 0x0 |
| 30:5 | Reserved. | - | - |
| 4 | USBPHY_AS_GPIO : Use the usb DP and DM pins as GPIO pins instead of connecting them to the USB controller. | RW | 0x0 |
| 3 | SOFTCON | RW | 0x0 |
| 2 | TO_DIGITAL_PAD | RW | 0x0 |
| 1 | TO_EXTPHY | RW | 0x0 |
| 0 | TO_PHY | RW | 0x1 |
USB: USB_PWR Register
Offset: 0x078
Description
Overrides for the power signals in the event that the VBUS signals are not hooked up to GPIO. Set the value of the override and then the override enable to switch over to the override value.
Table 1212. USB_PWR Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5 | OVERCURR_DETECT_EN | RW | 0x0 |
| 4 | OVERCURR_DETECT | RW | 0x0 |
| 3 | VBUS_DETECT_OVERRIDE_EN | RW | 0x0 |
| 2 | VBUS_DETECT | RW | 0x0 |
| 1 | VBUS_EN_OVERRIDE_EN | RW | 0x0 |
| 0 | VBUS_EN | RW | 0x0 |
USB: USBPHY_DIRECT Register
Offset: 0x07c
Description
This register allows for direct control of the USB phy. Use in conjunction with usbphy_direct_override register to enable each override bit.
Table 1213.
USBPHY_DIRECT Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:26 | Reserved. | - | - |
| 25 | RX_DM_OVERRIDE : Override rx_dm value into controller | RW | 0x0 |
| 24 | RX_DP_OVERRIDE : Override rx_dp value into controller | RW | 0x0 |
| 23 | RX_DD_OVERRIDE : Override rx_dd value into controller | RW | 0x0 |
| 22 | DM_OVV : DM over voltage | RO | 0x0 |
| 21 | DP_OVV : DP over voltage | RO | 0x0 |
| 20 | DM_OVCN : DM overcurrent | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 19 | DP_OVCN : DP overcurrent | RO | 0x0 |
| 18 | RX_DM : DPM pin state | RO | 0x0 |
| 17 | RX_DP : DPP pin state | RO | 0x0 |
| 16 | RX_DD : Differential RX | RO | 0x0 |
| 15 | TX_DIFFMODE
: TX_DIFFMODE=0: Single ended mode TX_DIFFMODE=1: Differential drive mode (TX_DM, TX_DM_OE ignored) | RW | 0x0 |
| 14 | TX_FSSLEW
: TX_FSSLEW=0: Low speed slew rate TX_FSSLEW=1: Full speed slew rate | RW | 0x0 |
| 13 | TX_PD : TX power down override (if override enable is set). 1 = powered down. | RW | 0x0 |
| 12 | RX_PD : RX power down override (if override enable is set). 1 = powered down. | RW | 0x0 |
| 11 | TX_DM
: Output data. TX_DIFFMODE=1, Ignored TX_DIFFMODE=0, Drives DPM only. TX_DM_OE=1 to enable drive. DPM=TX_DM | RW | 0x0 |
| 10 | TX_DP
: Output data. If TX_DIFFMODE=1, Drives DPP/DPM diff pair. TX_DP_OE=1 to enable drive. DPP=TX_DP, DPM=~TX_DP If TX_DIFFMODE=0, Drives DPP only. TX_DP_OE=1 to enable drive. DPP=TX_DP | RW | 0x0 |
| 9 | TX_DM_OE
: Output enable. If TX_DIFFMODE=1, Ignored. If TX_DIFFMODE=0, OE for DPM only. 0 - DPM in Hi-Z state; 1 - DPM driving | RW | 0x0 |
| 8 | TX_DP_OE
: Output enable. If TX_DIFFMODE=1, OE for DPP/DPM diff pair. 0 - DPP/DPM in Hi-Z state; 1 - DPP/DPM driving If TX_DIFFMODE=0, OE for DPP only. 0 - DPP in Hi-Z state; 1 - DPP driving | RW | 0x0 |
| 7 | Reserved. | - | - |
| 6 | DM_PULLDN_EN : DM pull down enable | RW | 0x0 |
| 5 | DM_PULLUP_EN : DM pull up enable | RW | 0x0 |
| 4 | DM_PULLUP_HISEL : Enable the second DM pull up resistor. 0 - Pull = Rpu2; 1 - Pull = Rpu1 + Rpu2 | RW | 0x0 |
| 3 | Reserved. | - | - |
| 2 | DP_PULLDN_EN : DP pull down enable | RW | 0x0 |
| 1 | DP_PULLUP_EN : DP pull up enable | RW | 0x0 |
| 0 | DP_PULLUP_HISEL : Enable the second DP pull up resistor. 0 - Pull = Rpu2; 1 - Pull = Rpu1 + Rpu2 | RW | 0x0 |
USB: USBPHY_DIRECT_OVERRIDE Register
Offset: 0x080
Description
Override enable for each control in usbphy_direct
Table 1214.
USBPHY_DIRECT_OVERRIDE Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:19 | Reserved. | - | - |
| 18 | RX_DM_OVERRIDE_EN | RW | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 17 | RX_DP_OVERRIDE_EN | RW | 0x0 |
| 16 | RX_DD_OVERRIDE_EN | RW | 0x0 |
| 15 | TX_DIFFMODE_OVERRIDE_EN | RW | 0x0 |
| 14:13 | Reserved. | - | - |
| 12 | DM_PULLUP_OVERRIDE_EN | RW | 0x0 |
| 11 | TX_FSSLEW_OVERRIDE_EN | RW | 0x0 |
| 10 | TX_PD_OVERRIDE_EN | RW | 0x0 |
| 9 | RX_PD_OVERRIDE_EN | RW | 0x0 |
| 8 | TX_DM_OVERRIDE_EN | RW | 0x0 |
| 7 | TX_DP_OVERRIDE_EN | RW | 0x0 |
| 6 | TX_DM_OE_OVERRIDE_EN | RW | 0x0 |
| 5 | TX_DP_OE_OVERRIDE_EN | RW | 0x0 |
| 4 | DM_PULLDN_EN_OVERRIDE_EN | RW | 0x0 |
| 3 | DP_PULLDN_EN_OVERRIDE_EN | RW | 0x0 |
| 2 | DP_PULLUP_EN_OVERRIDE_EN | RW | 0x0 |
| 1 | DM_PULLUP_HISEL_OVERRIDE_EN | RW | 0x0 |
| 0 | DP_PULLUP_HISEL_OVERRIDE_EN | RW | 0x0 |
USB: USBPHY_TRIM Register
Offset: 0x084
Description
Used to adjust trim values of USB phy pull down resistors.
Table 1215.
USBPHY_TRIM
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:13 | Reserved. | - | - |
| 12:8 | DM_PULLDN_TRIM:
Value to drive to USB PHY DM pulldown resistor trim control Experimental data suggests that the reset value will work, but this register allows adjustment if required | RW | 0x1f |
| 7:5 | Reserved. | - | - |
| 4:0 | DP_PULLDN_TRIM:
Value to drive to USB PHY DP pulldown resistor trim control Experimental data suggests that the reset value will work, but this register allows adjustment if required | RW | 0x1f |
USB: LINESTATE_TUNING Register
Offset: 0x088
Description
Used for debug only.
Table 1216.
LINESTATE_TUNING
Register
| Bits 2 1 0 Bits | Description RESET PUSH DATA Description | : Reset (before sending a new key) | Type RW RW RW Type | Reset 0x0 0x0 0x0 Reset |
|---|---|---|---|---|
| Register 31:12 | Reserved. | - | - | |
| 11:8 | SPARE_FIX | RW | 0x0 | |
| 7 | DEV_LS_WAKE_FIX | : Device - exit suspend on any non-idle signalling, not qualified with a 1ms timer | RW | 0x1 |
| 6 | DEV_RX_ERR_QUIESCE | : Device - suppress repeated errors until the device FSM is next in the process of decoding an inbound packet. | RW | 0x1 |
| 5 | SIE_RX_CHATTER_SE0_FIX | : RX - when recovering from line chatter or bitstuff errors, treat SE0 as the end of chatter as well as 8 consecutive idle bits. | RW | 0x1 |
| 4 | SIE_RX_BITSTUFF_FIX | : RX - when a bitstuff error is signalled by rx_dasm, unconditionally terminate RX decode to avoid a hang during certain packet phases. | RW | 0x1 |
| 3 | DEV_BUFF_CONTROL_DOUBLE_READ_FIX match. | : Device - the controller FSM performs two reads of the buffer status memory address to | RW | 0x1 |
| 2 | MULTI_HUB_FIX | : Host - increase inter-packet and turnaround timeouts to accommodate worst-case hub delays. | RW | 0x0 |
| 1 | LINESTATE_DELAY sampling. | : Device/Host - add an extra 1-bit debounce of linestate | RW | 0x0 |
| 0 | RCV_DELAY | : Device - register the received data to account for hub bit dribble before EOP. Only affects certain hubs. | RW | 0x0 |
| Bits | Raw Interrupts Description | Type | Reset | |
| 31:24 | Reserved. | - | - | |
| 23 | EPX_STOPPED_ON_NAK | : Source: NAK_POLL.EPX_STOPPED_ON_NAK | RO | 0x0 |
| 22 | DEV_SM_WATCHDOG_FIRED | : Source: DEV_SM_WATCHDOG.FIRED | RO | 0x0 |
| 21 | ENDPOINT_ERROR | : Source: SIE_STATUS.ENDPOINT_ERROR | RO | 0x0 |
| 20 | RX_SHORT_PACKET | : Source: SIE_STATUS.RX_SHORT_PACKET | RO | 0x0 |
| 19 | EP_STALL_NAK | : Raised when any bit in EP_STATUS_STALL_NAK is set. Clear by clearing all bits in EP_STATUS_STALL_NAK. | RO | 0x0 |
| 18 | ABORT_DONE | : Raised when any bit in ABORT_DONE is set. Clear by clearing all bits in ABORT_DONE. | RO | 0x0 |
| 17 | DEV_SOF : Set every time the device receives a SOF (Start of Frame) packet. | RO | 0x0 | |
| 16 | SETUP_REQ | : Device. Source: SIE_STATUS.SETUP_REC | RO | 0x0 |
| 15 | DEV_RESUME_FROM_HOST | : Set when the device receives a resume from the host. Cleared by writing to SIE_STATUS.RESUME | RO | 0x0 |
USB: INTR Register
Offset: 0x08c
Description
Raw Interrupts
Table 1217. INTR
Register
| Bits 2 1 0 Bits | Description RESET PUSH DATA Description | : Reset (before sending a new key) | Type RW RW RW Type | Reset 0x0 0x0 0x0 Reset |
|---|---|---|---|---|
| 9 | ERROR_CRC | : Source: SIE_STATUS.CRC_ERROR | RO | 0x0 |
| 8 | ERROR_BIT_STUFF | : Source: SIE_STATUS.BIT_STUFF_ERROR | RO | 0x0 |
| 7 | ERROR_RX_OVERFLOW | : Source: SIE_STATUS.RX_OVERFLOW | RO | 0x0 |
| 6 | ERROR_RX_TIMEOUT | : Source: SIE_STATUS.RX_TIMEOUT | RO | 0x0 |
| 5 | ERROR_DATA_SEQ | : Source: SIE_STATUS.DATA_SEQ_ERROR | RO | 0x0 |
| 4 | BUFF_STATUS | : Raised when any bit in BUFF_STATUS is set. Clear by clearing all bits in BUFF_STATUS. | RO | 0x0 |
| 3 | TRANS_COMPLETE | : Raised every time SIE_STATUS.TRANS_COMPLETE is set. Clear by writing to this bit. | RO | 0x0 |
| 2 | HOST_SOF | : Host: raised every time the host sends a SOF (Start of Frame). Cleared by reading SOF_RD | RO | 0x0 |
| 1 | HOST_RESUME | : Host: raised when a device wakes up the host. Cleared by writing to SIE_STATUS.RESUME | RO | 0x0 |
| 0 | HOST_CONN_DIS | : Host: raised when a device is connected or disconnected (i.e. when SIE_STATUS.SPEED changes). Cleared by writing to | RO | 0x0 |
| Bits | Interrupt Enable Description | Type | Reset | |
| 31:24 | Reserved. | - | - | |
| 23 | EPX_STOPPED_ON_NAK | : Source: NAK_POLL.EPX_STOPPED_ON_NAK | RW | 0x0 |
| 22 | DEV_SM_WATCHDOG_FIRED | : Source: DEV_SM_WATCHDOG.FIRED | RW | 0x0 |
| 21 | ENDPOINT_ERROR | : Source: SIE_STATUS.ENDPOINT_ERROR | RW | 0x0 |
| 20 | RX_SHORT_PACKET | : Source: SIE_STATUS.RX_SHORT_PACKET | RW | 0x0 |
| 19 | EP_STALL_NAK | : Raised when any bit in EP_STATUS_STALL_NAK is set. Clear by clearing all bits in EP_STATUS_STALL_NAK. | RW | 0x0 |
| 18 | ABORT_DONE | : Raised when any bit in ABORT_DONE is set. Clear by clearing all bits in ABORT_DONE. | RW | 0x0 |
| 17 | DEV_SOF : Set every time the device receives a SOF (Start of Frame) packet. | RW | 0x0 |
USB: INTE Register
Offset: 0x090
Description
Interrupt Enable
Table 1218. INTE Register
| Bits 2 1 0 Bits | Description RESET PUSH DATA Description | : Reset (before sending a new key) | Type RW RW RW Type | Reset 0x0 0x0 0x0 Reset |
|---|---|---|---|---|
| 11 | VBUS_DETECT | : Source: SIE_STATUS.VBUS_DETECTED | RW | 0x0 |
| 10 | STALL : Source: SIE_STATUS.STALL_REC | RW | 0x0 | |
| 9 | ERROR_CRC | : Source: SIE_STATUS.CRC_ERROR | RW | 0x0 |
| 8 | ERROR_BIT_STUFF | : Source: SIE_STATUS.BIT_STUFF_ERROR | RW | 0x0 |
| 7 | ERROR_RX_OVERFLOW | : Source: SIE_STATUS.RX_OVERFLOW | RW | 0x0 |
| 6 | ERROR_RX_TIMEOUT | : Source: SIE_STATUS.RX_TIMEOUT | RW | 0x0 |
| 5 | ERROR_DATA_SEQ | : Source: SIE_STATUS.DATA_SEQ_ERROR | RW | 0x0 |
| 4 | BUFF_STATUS | : Raised when any bit in BUFF_STATUS is set. Clear by clearing all bits in BUFF_STATUS. | RW | 0x0 |
| 3 | TRANS_COMPLETE | : Raised every time SIE_STATUS.TRANS_COMPLETE is set. Clear by writing to this bit. | RW | 0x0 |
| 2 | HOST_SOF | : Host: raised every time the host sends a SOF (Start of Frame). Cleared by reading SOF_RD | RW | 0x0 |
| 1 | HOST_RESUME | : Host: raised when a device wakes up the host. Cleared by writing to SIE_STATUS.RESUME | RW | 0x0 |
| 0 | HOST_CONN_DIS | : Host: raised when a device is connected or disconnected (i.e. when SIE_STATUS.SPEED changes). Cleared by writing to | RW | 0x0 |
| Bits | Interrupt Force Description | Type | Reset | |
| 31:24 | Reserved. | - | - | |
| 23 | EPX_STOPPED_ON_NAK | : Source: NAK_POLL.EPX_STOPPED_ON_NAK | RW | 0x0 |
| 22 | DEV_SM_WATCHDOG_FIRED | : Source: DEV_SM_WATCHDOG.FIRED | RW | 0x0 |
| 21 | ENDPOINT_ERROR | : Source: SIE_STATUS.ENDPOINT_ERROR | RW | 0x0 |
| 20 | RX_SHORT_PACKET | : Source: SIE_STATUS.RX_SHORT_PACKET | RW | 0x0 |
| 19 | EP_STALL_NAK | : Raised when any bit in EP_STATUS_STALL_NAK is set. Clear by clearing all bits in EP_STATUS_STALL_NAK. | RW | 0x0 |
USB: INTF Register
Offset: 0x094
Description
Interrupt Force
Table 1219. INTF Register
| Bits 2 1 0 Bits | Description RESET PUSH DATA Description | : Reset (before sending a new key) | Type RW RW RW Type | Reset 0x0 0x0 0x0 Reset |
|---|---|---|---|---|
| 13 | DEV_CONN_DIS | : Set when the device connection state changes. Cleared by | RW | 0x0 |
| 12 | BUS_RESET | writing to SIE_STATUS.CONNECTED : Source: SIE_STATUS.BUS_RESET | RW | 0x0 |
| 11 | VBUS_DETECT | : Source: SIE_STATUS.VBUS_DETECTED | RW | 0x0 |
| 10 | STALL : Source: SIE_STATUS.STALL_REC | RW | 0x0 | |
| 9 | ERROR_CRC | : Source: SIE_STATUS.CRC_ERROR | RW | 0x0 |
| 8 | ERROR_BIT_STUFF | : Source: SIE_STATUS.BIT_STUFF_ERROR | RW | 0x0 |
| 7 | ERROR_RX_OVERFLOW | : Source: SIE_STATUS.RX_OVERFLOW | RW | 0x0 |
| 6 | ERROR_RX_TIMEOUT | : Source: SIE_STATUS.RX_TIMEOUT | RW | 0x0 |
| 5 | ERROR_DATA_SEQ | : Source: SIE_STATUS.DATA_SEQ_ERROR | RW | 0x0 |
| 4 | BUFF_STATUS | : Raised when any bit in BUFF_STATUS is set. Clear by clearing | RW | 0x0 |
| 3 | TRANS_COMPLETE | all bits in BUFF_STATUS. : Raised every time SIE_STATUS.TRANS_COMPLETE is | RW | 0x0 |
| 2 | HOST_SOF | set. Clear by writing to this bit. : Host: raised every time the host sends a SOF (Start of Frame). | RW | 0x0 |
| 1 | HOST_RESUME | Cleared by reading SOF_RD : Host: raised when a device wakes up the host. Cleared by | RW | 0x0 |
| 0 | HOST_CONN_DIS | writing to SIE_STATUS.RESUME : Host: raised when a device is connected or disconnected (i.e. when SIE_STATUS.SPEED changes). Cleared by writing to | RW | 0x0 |
| Bits | Description | Type | Reset | |
| 31:24 | Reserved. | - | - | |
| 23 | EPX_STOPPED_ON_NAK | : Source: NAK_POLL.EPX_STOPPED_ON_NAK | RO | 0x0 |
| 22 | DEV_SM_WATCHDOG_FIRED | : Source: DEV_SM_WATCHDOG.FIRED | RO | 0x0 |
| 21 | ENDPOINT_ERROR | : Source: SIE_STATUS.ENDPOINT_ERROR | RO | 0x0 |
USB: INTS Register
Offset: 0x098
Description
Interrupt status after masking & forcing
Table 1220. INTS Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 20 | RX_SHORT_PACKET : Source: SIE_STATUS.RX_SHORT_PACKET | RO | 0x0 |
| 19 | EP_STALL_NAK : Raised when any bit in EP_STATUS_STALL_NAK is set. Clear by clearing all bits in EP_STATUS_STALL_NAK. | RO | 0x0 |
| 18 | ABORT_DONE : Raised when any bit in ABORT_DONE is set. Clear by clearing all bits in ABORT_DONE. | RO | 0x0 |
| 17 | DEV_SOF : Set every time the device receives a SOF (Start of Frame) packet. Cleared by reading SOF_RD | RO | 0x0 |
| 16 | SETUP_REQ : Device. Source: SIE_STATUS.SETUP_REC | RO | 0x0 |
| 15 | DEV_RESUME_FROM_HOST : Set when the device receives a resume from the host. Cleared by writing to SIE_STATUS.RESUME | RO | 0x0 |
| 14 | DEV_SUSPEND : Set when the device suspend state changes. Cleared by writing to SIE_STATUS.SUSPENDED | RO | 0x0 |
| 13 | DEV_CONN_DIS : Set when the device connection state changes. Cleared by writing to SIE_STATUS.CONNECTED | RO | 0x0 |
| 12 | BUS_RESET : Source: SIE_STATUS.BUS_RESET | RO | 0x0 |
| 11 | VBUS_DETECT : Source: SIE_STATUS.VBUS_DETECTED | RO | 0x0 |
| 10 | STALL : Source: SIE_STATUS.STALL_REC | RO | 0x0 |
| 9 | ERROR_CRC : Source: SIE_STATUS.CRC_ERROR | RO | 0x0 |
| 8 | ERROR_BIT_STUFF : Source: SIE_STATUS.BIT_STUFF_ERROR | RO | 0x0 |
| 7 | ERROR_RX_OVERFLOW : Source: SIE_STATUS.RX_OVERFLOW | RO | 0x0 |
| 6 | ERROR_RX_TIMEOUT : Source: SIE_STATUS.RX_TIMEOUT | RO | 0x0 |
| 5 | ERROR_DATA_SEQ : Source: SIE_STATUS.DATA_SEQ_ERROR | RO | 0x0 |
| 4 | BUFF_STATUS : Raised when any bit in BUFF_STATUS is set. Clear by clearing all bits in BUFF_STATUS. | RO | 0x0 |
| 3 | TRANS_COMPLETE : Raised every time SIE_STATUS.TRANS_COMPLETE is set. Clear by writing to this bit. | RO | 0x0 |
| 2 | HOST_SOF : Host: raised every time the host sends a SOF (Start of Frame). Cleared by reading SOF_RD | RO | 0x0 |
| 1 | HOST_RESUME : Host: raised when a device wakes up the host. Cleared by writing to SIE_STATUS.RESUME | RO | 0x0 |
| 0 | HOST_CONN_DIS : Host: raised when a device is connected or disconnected (i.e. when SIE_STATUS.SPEED changes). Cleared by writing to SIE_STATUS.SPEED | RO | 0x0 |
USB: SOF_TIMESTAMP_RAW Register
Offset: 0x100
Table 1221.
SOF_TIMESTAMP_RA
W Register
| Bits Register 31:28 27 26 25 24 | Description QSPI_SD QSPI_CSN QSPI_SCK USB_DM USB_DP | Type WO WO WO WO WO | Reset 0x0 0x0 0x0 0x0 0x0 |
|---|---|---|---|
| W Register 31:21 | Reserved. | - - | |
| 20:0 | Device only. Raw value of free-running PHY clock counter @48MHz. Used to calculate time between SOF events. | RO 0x000000 | |
| Table 1222. Offset Bits | : 0x104 Description | Type Reset | |
| SOF_TIMESTAMP_LAS T Register 31:21 | Reserved. | - - | |
| 20:0 | Device only. Value of free-running PHY clock counter @48MHz when last SOF event occured. | RO 0x000000 | |
| Table 1223. Offset Bits | : 0x108 Description | Type | Reset |
| SM_STATE Register 31:12 | Reserved. | - | - |
| 11:8 | RX_DASM | RO | 0x0 |
| 7:5 | BC_STATE | RO | 0x0 |
| 4:0 | STATE | RO | 0x00 |
| Description TX error count for each endpoint. Write to each field to reset the counter to 0 | . | ||
| Table 1224. Bits | TX error count for each endpoint. Write to each field to reset the counter to 0 Description | . Type | Reset |
| EP_TX_ERROR Register 31:30 | EP15 | WC | 0x0 |
| 29:28 | EP14 | WC | 0x0 |
| 27:26 | EP13 | WC | 0x0 |
| 25:24 | EP12 | WC | 0x0 |
| 23:22 | EP11 | WC | 0x0 |
| 21:20 | EP10 | WC | 0x0 |
| 19:18 | EP9 | WC | 0x0 |
| 17:16 | EP8 | WC | 0x0 |
| 15:14 | EP7 | WC | 0x0 |
| 13:12 | EP6 | WC | 0x0 |
| 11:10 | EP5 | WC | 0x0 |
| 9:8 | EP4 | WC | 0x0 |
| 7:6 | EP3 | WC | 0x0 |
USB: SOF_TIMESTAMP_LAST Register
Offset: 0x104
Table 1222.
SOF_TIMESTAMP_LAS
T Register
USB: SM_STATE Register
Offset: 0x108
Table 1223.
SM_STATE Register
USB: EP_TX_ERROR Register
Offset: 0x10c
Description
TX error count for each endpoint. Write to each field to reset the counter to 0.
Table 1224.
EP_TX_ERROR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 5:4 | EP2 | WC | 0x0 |
| 3:2 | EP1 | WC | 0x0 |
| 1:0 | EP0 | WC | 0x0 |
USB: EP_RX_ERROR Register
Offset: 0x110
Description
RX error count for each endpoint. Write to each field to reset the counter to 0.
Table 1225.
EP_RX_ERROR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | EP15_SEQ | WC | 0x0 |
| 30 | EP15_TRANSACTION | WC | 0x0 |
| 29 | EP14_SEQ | WC | 0x0 |
| 28 | EP14_TRANSACTION | WC | 0x0 |
| 27 | EP13_SEQ | WC | 0x0 |
| 26 | EP13_TRANSACTION | WC | 0x0 |
| 25 | EP12_SEQ | WC | 0x0 |
| 24 | EP12_TRANSACTION | WC | 0x0 |
| 23 | EP11_SEQ | WC | 0x0 |
| 22 | EP11_TRANSACTION | WC | 0x0 |
| 21 | EP10_SEQ | WC | 0x0 |
| 20 | EP10_TRANSACTION | WC | 0x0 |
| 19 | EP9_SEQ | WC | 0x0 |
| 18 | EP9_TRANSACTION | WC | 0x0 |
| 17 | EP8_SEQ | WC | 0x0 |
| 16 | EP8_TRANSACTION | WC | 0x0 |
| 15 | EP7_SEQ | WC | 0x0 |
| 14 | EP7_TRANSACTION | WC | 0x0 |
| 13 | EP6_SEQ | WC | 0x0 |
| 12 | EP6_TRANSACTION | WC | 0x0 |
| 11 | EP5_SEQ | WC | 0x0 |
| 10 | EP5_TRANSACTION | WC | 0x0 |
| 9 | EP4_SEQ | WC | 0x0 |
| 8 | EP4_TRANSACTION | WC | 0x0 |
| 7 | EP3_SEQ | WC | 0x0 |
| 6 | EP3_TRANSACTION | WC | 0x0 |
| 5 | EP2_SEQ | WC | 0x0 |
| Bits 4 3 2 1 0 | Description EP2_TRANSACTION EP1_SEQ EP1_TRANSACTION EP0_SEQ EP0_TRANSACTION | Type WC WC WC WC WC | Reset 0x0 0x0 0x0 0x0 0x0 |
|---|---|---|---|
| Bits DEV_SM_WATCHDOG | Description | Type | Reset |
| Register 31:21 | Reserved. | - | - |
| 20 | FIRED | WC | 0x0 |
| 19 | RESET | : Set to 1 to forcibly reset the device state machine on watchdog expiry RW | 0x0 |
| 18 | ENABLE | RW | 0x0 |
| 17:0 | LIMIT | RW | 0x00000 |
| based on this timebase. RP2350 has two instances of the system timer: separately controlled timers, each in a different security domain. It supports the following features: A single 64-bit counter, incrementing once per microsecond | TIMER0 and TIMER1 | . This allows for two | |
| Four alarms that match on the lower 32 bits of the counter and generate IRQ on match The timer uses a one microsecond reference generated by the tick generators (see | Section 8.5 | ), and derived from the | |
| reference clock (Figure 33 | ), which itself is usually connected directly to the crystal oscillator ( | Section 8.2) . | |
| • | 12.8.1.1. Changes from RP2040 RP2350 now has two timer instances: | TIMER0 and TIMER1 | |
| • | On RP2350, the tick source for each timer comes from the system-level tick generators (see | Section 8.5) | |
| • | RP2350 added two new registers: LOCKED | is used to disable write access to the timer, and | SOURCE allows the timer to |
USB: DEV_SM_WATCHDOG Register
Offset: 0x114
Description
Watchdog that forces the device state machine to idle and raises an interrupt if the device stays in a state that isn't idle for the configured limit. The counter is reset on every state transition.
Set limit while enable is low and then set the enable.
Table 1226.
DEV_SM_WATCHDOG
Register