← index #18551Issue #16083
Related · high · value 1.079
QUERY · ISSUE

docs: RP2 DMA some defaults missing/incorrect

openby sfe-SparkFroopened 2025-12-11updated 2026-02-09
docs

Documentation URL

https://docs.micropython.org/en/latest/library/rp2.DMA.html#rp2.DMA.pack_ctrl

Description

The following keys have an incorrect default specified:

  • bswap (docs claim it's True, but it's actually False)

The following keys do not have defaults specified:

  • ring_size (should be 0)
  • ring_sel (should be False)
  • treq_sel (should be 63 or 0x3f)
    • Would be good to add a note explaining this, since it's not listed in the DREQ table in the datasheet.
  • write_err (should be False)
  • read_err (should be False)

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

docs: DMA chain example shows incorrect use of DMA.registers

openby sk8boardopened 2024-10-26updated 2025-11-08
docsport-rp2

Documentation URL

https://docs.micropython.org/en/latest/library/rp2.DMA.html#chaining-and-trigger-register-access

Description

Port, board and/or hardware

rp2, Pico RP2040

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico with RP2040

Reproduction

import rp2

test_dma = rp2.DMA()

test_dma.active(1)

print("R",hex(test_dma.registers[0]))
print("W",hex(test_dma.registers[1]))
print("T",hex(test_dma.registers[2]))
print("C",hex(test_dma.registers[3]))
print("C",hex(test_dma.registers[4]))
print("R",hex(test_dma.registers[5]))
print("W",hex(test_dma.registers[6]))
print("T",hex(test_dma.registers[7]))
print("C",hex(test_dma.registers[8]))
print("T",hex(test_dma.registers[9]))
print("R",hex(test_dma.registers[10]))
print("W",hex(test_dma.registers[11]))
print("C",hex(test_dma.registers[12]))
print("W",hex(test_dma.registers[13]))
print("T",hex(test_dma.registers[14]))
print("R",hex(test_dma.registers[15]))

Expected behaviour

Base on the DMA chain example, I expected a result with the address of a DMA register.

image

Observed behaviour

I received this result, which shows the value within the DMA register.

image

Additional Information

With regard to DMA.config(), this documentation states:

write: The address to which the DMA controller will start writing or an object into which data will be written.

This example, shows:

gather_dma.config(
        read=gather_list, write=buffer_dma.registers[14:16],
        count=2, ctrl=gather_ctrl
    )

where DMA.registers is used to obtain the address of the register.

Because of how DMA.registers is used in the example, I expected DMA.registers to provide DMA register address, but the result shows DMA.registers provides values within the register.

Therefore, the example is showing incorrect use of DMA.registers, which has caused confusion as shown here.

Recommendation:

  1. Update DMA.registers with additional language to explain how to use DMA.registers and the expected result.

  2. Update the chain example to include two common chain use cases:
    a) "ping-pong" when changes in DMA config are not needed
    b) when one DMA is used to change the config of another DMA
    i) provide a way to write to a DMA register. possibly uctypes.addressof(DMA.register) + offset ?

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied