rp23 Part59
rp23 Part59
1 Reserved. - -
Description
interrupt endpoint control register
Table 1202.
Bits Description Type Reset
INT_EP_CTRL Register
31:16 Reserved. - -
0 Reserved. - -
Description
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.
Table 1203.
Bits Description Type Reset
BUFF_STATUS
Register
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
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 1204.
Bits Description Type Reset
BUFF_CPU_SHOULD_H
ANDLE Register
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
0 EP0_IN RO 0x0
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 1205.
Bits Description Type Reset
EP_ABORT Register
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
3 EP1_OUT RW 0x0
2 EP1_IN RW 0x0
1 EP0_OUT RW 0x0
0 EP0_IN RW 0x0
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 1206.
Bits Description Type Reset
EP_ABORT_DONE
Register
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
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 1207.
Bits Description Type Reset
EP_STALL_ARM
Register
31:2 Reserved. - -
1 EP0_OUT RW 0x0
0 EP0_IN RW 0x0
Description
Used by the host controller. Sets the wait time in microseconds before trying again if the device replies with a NAK.
Table 1208.
Bits Description Type Reset
NAK_POLL Register
25:16 DELAY_FS: NAK polling interval for a full speed device RW 0x010
9:0 DELAY_LS: NAK polling interval for a low speed device RW 0x010
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 1209.
Bits Description Type Reset
EP_STATUS_STALL_N
AK Register
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
Description
Where to connect the USB controller. Should be to_phy by default.
Table 1210.
Bits Description Type Reset
USB_MUXING Register
31 SWAP_DPDM: Swap the USB PHY DP and DM pins and all related controls and RW 0x0
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.
30:5 Reserved. - -
4 USBPHY_AS_GPIO: Use the usb DP and DM pins as GPIO pins instead of RW 0x0
connecting them to the USB controller.
3 SOFTCON RW 0x0
2 TO_DIGITAL_PAD RW 0x0
1 TO_EXTPHY RW 0x0
0 TO_PHY RW 0x1
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.
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
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 1212.
Bits Description Type Reset
USBPHY_DIRECT
Register
31:26 Reserved. - -
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
7 Reserved. - -
3 Reserved. - -
Description
Override enable for each control in usbphy_direct
Table 1213.
Bits Description Type Reset
USBPHY_DIRECT_OVE
RRIDE Register
31:19 Reserved. - -
18 RX_DM_OVERRIDE_EN RW 0x0
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
Description
Used to adjust trim values of USB phy pull down resistors.
Table 1214.
Bits Description Type Reset
USBPHY_TRIM
Register
31:13 Reserved. - -
7:5 Reserved. - -
Description
Used for debug only.
Table 1215.
Bits Description Type Reset
LINESTATE_TUNING
Register
31:12 Reserved. - -
0 RCV_DELAY: Device - register the received data to account for hub bit dribble RW 0x0
before EOP. Only affects certain hubs.
Description
Raw Interrupts
31:24 Reserved. - -
18 ABORT_DONE: Raised when any bit in ABORT_DONE is set. Clear by clearing RO 0x0
all bits in ABORT_DONE.
17 DEV_SOF: Set every time the device receives a SOF (Start of Frame) packet. RO 0x0
Cleared by reading SOF_RD
15 DEV_RESUME_FROM_HOST: Set when the device receives a resume from the RO 0x0
host. Cleared by writing to SIE_STATUS.RESUME
14 DEV_SUSPEND: Set when the device suspend state changes. Cleared by RO 0x0
writing to SIE_STATUS.SUSPENDED
13 DEV_CONN_DIS: Set when the device connection state changes. Cleared by RO 0x0
writing to SIE_STATUS.CONNECTED
4 BUFF_STATUS: Raised when any bit in BUFF_STATUS is set. Clear by clearing RO 0x0
all bits in BUFF_STATUS.
2 HOST_SOF: Host: raised every time the host sends a SOF (Start of Frame). RO 0x0
Cleared by reading SOF_RD
1 HOST_RESUME: Host: raised when a device wakes up the host. Cleared by RO 0x0
writing to SIE_STATUS.RESUME
Description
Interrupt Enable
31:24 Reserved. - -
18 ABORT_DONE: Raised when any bit in ABORT_DONE is set. Clear by clearing RW 0x0
all bits in ABORT_DONE.
17 DEV_SOF: Set every time the device receives a SOF (Start of Frame) packet. RW 0x0
Cleared by reading SOF_RD
15 DEV_RESUME_FROM_HOST: Set when the device receives a resume from the RW 0x0
host. Cleared by writing to SIE_STATUS.RESUME
14 DEV_SUSPEND: Set when the device suspend state changes. Cleared by RW 0x0
writing to SIE_STATUS.SUSPENDED
13 DEV_CONN_DIS: Set when the device connection state changes. Cleared by RW 0x0
writing to SIE_STATUS.CONNECTED
4 BUFF_STATUS: Raised when any bit in BUFF_STATUS is set. Clear by clearing RW 0x0
all bits in BUFF_STATUS.
2 HOST_SOF: Host: raised every time the host sends a SOF (Start of Frame). RW 0x0
Cleared by reading SOF_RD
1 HOST_RESUME: Host: raised when a device wakes up the host. Cleared by RW 0x0
writing to SIE_STATUS.RESUME
Offset: 0x094
Description
Interrupt Force
31:24 Reserved. - -
18 ABORT_DONE: Raised when any bit in ABORT_DONE is set. Clear by clearing RW 0x0
all bits in ABORT_DONE.
17 DEV_SOF: Set every time the device receives a SOF (Start of Frame) packet. RW 0x0
Cleared by reading SOF_RD
15 DEV_RESUME_FROM_HOST: Set when the device receives a resume from the RW 0x0
host. Cleared by writing to SIE_STATUS.RESUME
14 DEV_SUSPEND: Set when the device suspend state changes. Cleared by RW 0x0
writing to SIE_STATUS.SUSPENDED
13 DEV_CONN_DIS: Set when the device connection state changes. Cleared by RW 0x0
writing to SIE_STATUS.CONNECTED
4 BUFF_STATUS: Raised when any bit in BUFF_STATUS is set. Clear by clearing RW 0x0
all bits in BUFF_STATUS.
2 HOST_SOF: Host: raised every time the host sends a SOF (Start of Frame). RW 0x0
Cleared by reading SOF_RD
1 HOST_RESUME: Host: raised when a device wakes up the host. Cleared by RW 0x0
writing to SIE_STATUS.RESUME
Description
Interrupt status after masking & forcing
31:24 Reserved. - -
18 ABORT_DONE: Raised when any bit in ABORT_DONE is set. Clear by clearing RO 0x0
all bits in ABORT_DONE.
17 DEV_SOF: Set every time the device receives a SOF (Start of Frame) packet. RO 0x0
Cleared by reading SOF_RD
15 DEV_RESUME_FROM_HOST: Set when the device receives a resume from the RO 0x0
host. Cleared by writing to SIE_STATUS.RESUME
14 DEV_SUSPEND: Set when the device suspend state changes. Cleared by RO 0x0
writing to SIE_STATUS.SUSPENDED
13 DEV_CONN_DIS: Set when the device connection state changes. Cleared by RO 0x0
writing to SIE_STATUS.CONNECTED
4 BUFF_STATUS: Raised when any bit in BUFF_STATUS is set. Clear by clearing RO 0x0
all bits in BUFF_STATUS.
2 HOST_SOF: Host: raised every time the host sends a SOF (Start of Frame). RO 0x0
Cleared by reading SOF_RD
1 HOST_RESUME: Host: raised when a device wakes up the host. Cleared by RO 0x0
writing to SIE_STATUS.RESUME
Table 1220.
Bits Description Type Reset
SOF_TIMESTAMP_RA
W Register
31:21 Reserved. - -
20:0 Device only. Raw value of free-running PHY clock counter @48MHz. Used to RO 0x000000
calculate time between SOF events.
Table 1221.
Bits 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 RO 0x000000
event occured.
Table 1222.
Bits Description Type Reset
SM_STATE Register
31:12 Reserved. - -
Description
TX error count for each endpoint. Write to each field to reset the counter to 0.
Table 1223.
Bits Description Type Reset
EP_TX_ERROR
Register
31:30 EP15 WC 0x0
Description
RX error count for each endpoint. Write to each field to reset the counter to 0.
Table 1224.
Bits Description Type Reset
EP_RX_ERROR
Register
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
4 EP2_TRANSACTION WC 0x0
3 EP1_SEQ WC 0x0
2 EP1_TRANSACTION WC 0x0
1 EP0_SEQ WC 0x0
0 EP0_TRANSACTION WC 0x0
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 1225.
Bits Description Type Reset
DEV_SM_WATCHDOG
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
12.8.1. Overview
The system timer peripheral on RP2350 provides a microsecond timebase for the system, and generates interrupts
based on this timebase. RP2350 has two instances of the system timer: TIMER0 and TIMER1. This allows for two
separately controlled timers, each in a different security domain. It supports the following features:
The 64-bit counter effectively cannot overflow (thousands of years at 1 MHz), so the system timer is completely
monotonic in practice.
The system timer provides a global timebase for software. RP2350 has a number of other programmable counter
resources which can provide regular interrupts, or trigger DMA transfers.
• The PWM (Section 12.5) contains 12× 16-bit programmable counters. These counters:
◦ run at up to system speed
◦ can generate interrupts to either of two system IRQ lines
◦ can be continuously reprogrammed via the DMA
◦ can trigger DMA transfers to other peripherals
• 12× PIO state machines (Chapter 11) can count 32-bit values at system speed, and generate interrupts.
• The DMA (Section 12.6) has four internal pacing timers which trigger transfers at regular intervals.
• Each Cortex-M33 core (Section 3.7) has a standard 24-bit SysTick timer, counting either the microsecond tick
(Section 8.5) or the system clock.
• SIO has a standard 64-bit RISC-V platform timer (Section 3.1.8). Arm and RISC-V software can use this timer.
• The Power Manager (Chapter 6) incorporates a 64-bit timer (AON Timer) which nominally counts milliseconds (see
Section 12.10). This is the only timer that runs when the chip is in its lowest power state, with all switchable power
domains powered down. It is used to schedule power-ups.
12.8.2. Counter
The timer has a 64-bit counter, but RP2350 only has a 32-bit data bus. This means that the TIME value is accessed
through a pair of registers. These are:
CAUTION
Don’t write to the TIMEHW and TIMELW registers to force a new time value if other software may be using the timer. The
SDK uses the time value for timeouts, elapsed time, and more, and expects the value to increase monotonically.
12.8.3. Alarms
The timer has 4 alarms, and outputs a separate interrupt for each alarm. The alarms match on the lower 32 bits of the
64-bit counter, which means they can be fired at a maximum of 232 microseconds into the future. This is equivalent to:
• 2 ÷ 10 : ~4295 seconds
32 6
This timer supports alarm intervals on the order of one microsecond to one hour. For a longer alarm, see Section
12.10.
To enable an alarm:
1. Enable the interrupt at the timer with a write to the appropriate alarm bit in INTE (e.g. (1 << 0) for ALARM0).
2. Enable the appropriate timer interrupt at the processor (see Section 3.2).
3. Write the time you would like the interrupt to fire to ALARM0 (i.e. the current value in TIMERAWL plus your desired alarm
time in microseconds). Writing the time to the ALARM register sets the ARMED bit as a side effect.
Once the alarm has fired, the ARMED bit clears to 0. To clear the latched interrupt, write a 1 to the appropriate bit in INTR.
NOTE
The timer’s tick (see Section 8.5) must be running for the timer to start counting. The SDK starts this tick as part of
the platform initialisation code.
NOTE
Time here refers to the number of microseconds since the timer was started, not a clock. For a clock, see Section
12.10.
To read the 64-bit time, read TIMELR followed by TIMEHR. Reading TIMELR latches (stops) the value in TIMEHR until TIMEHR is
read. Because RP2350 has 2 cores, it is unsafe to do this if the second core executes code that can also access the
timer, or if the timer is read concurrently in an IRQ handler and in thread mode. If one core reads TIMELR followed by
another core reading TIMELR, the value in TIMEHR isn’t necessarily accurate. The example below shows the simplest form
of getting the 64-bit time:
The SDK provides a time_us_64 function that uses a more thorough method to get the 64-bit time, which makes use of
the TIMERAWH and TIMERAWL registers. The RAW registers don’t latch, making time_us_64 safe to call from multiple cores at
once.
The standalone timer example, timer_lowlevel, demonstrates how to set an alarm at a hardware level without the
additional abstraction over the timer provided by SDK. To use these abstractions, see Section 12.8.4.4.
27 // Use alarm 0
28 #define ALARM_NUM 0
29 #define ALARM_IRQ timer_hardware_alarm_get_irq_num(timer_hw, ALARM_NUM)
30
31 // Alarm interrupt handler
32 static volatile bool alarm_fired;
33
34 static void alarm_irq(void) {
35 // Clear the alarm irq
36 hw_clear_bits(&timer_hw->intr, 1u << ALARM_NUM);
37
38 // Assume alarm 0 has fired
39 printf("Alarm IRQ fired\n");
40 alarm_fired = true;
41 }
42
43 static void alarm_in_us(uint32_t delay_us) {
44 // Enable the interrupt for our alarm (the timer outputs 4 alarm irqs)
45 hw_set_bits(&timer_hw->inte, 1u << ALARM_NUM);
46 // Set irq handler for alarm irq
47 irq_set_exclusive_handler(ALARM_IRQ, alarm_irq);
48 // Enable the alarm irq
49 irq_set_enabled(ALARM_IRQ, true);
50 // Enable interrupt in block and at processor
51
52 // Alarm is only 32 bits so if trying to delay more
53 // than that need to be careful and keep track of the upper
54 // bits
55 uint64_t target = timer_hw->timerawl + delay_us;
56
57 // Write the lower 32 bits of the target time to the alarm which
58 // will arm it
59 timer_hw->alarm[ALARM_NUM] = (uint32_t) target;