Skip to content

rp2: Add HSTX support. - #18345

Open
sfe-SparkFro wants to merge 3 commits into
micropython:masterfrom
sparkfun:rp2_hstx
Open

sfe-SparkFro wants to merge 3 commits into
micropython:masterfrom
sparkfun:rp2_hstx

Conversation

@sfe-SparkFro

Copy link
Copy Markdown
Contributor

Summary

HSTX support for the RP2350! Resolves #17111

This implementation is similar to rp2.DMA in that the control registers values are created with pack functions. The FIFO registers are accessed with special functions. It also supports the buffer protocol (write only) so DMA transfers are relatively simple.

Note that this implementation is entirely application agnostic, unlike other HSTX implementations (which often just implement DVI, and end up hogging specific resources for it).

Testing

I've created 2 demos here. The first is a simple blink, the second is a DVI implementation.

Both tested to work with the following:

Though it should work with any RP2350 board and appropriate hardware to run the DVI example.

Trade-offs and Alternatives

On my machine, this adds 1852 bytes (+0.59%) to the RPI_PICO2 build. IMO this is worth the extra functionality for the reasons outlined in #17111.

@sfe-SparkFro

Copy link
Copy Markdown
Contributor Author

Oh also, would be good to implement this #17692 (comment) so Pin.ALT_HSTX can be used!

@github-actions

github-actions Bot commented Oct 29, 2025 •

Copy link
Copy Markdown

Code size report:

Reference:  shared/tinyusb: Remove macro guard for tx_overwritabe_if_not_connected. [207562d]
Comparison: rp2/hstx: Drain FIFO after soft reset. [merge of 74ee1eb]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge

Copy link
Copy Markdown
Member

Thanks for this, it looks good! I'll need to test it.

Eventually it will need docs, and ideally a test.

@sfe-SparkFro

Copy link
Copy Markdown
Contributor Author

Great to hear, thanks!

Also, this PR would benefit greatly from #18458 so the alt function can be set without the use of machine.mem32 😆

@sfe-SparkFro

Copy link
Copy Markdown
Contributor Author

Eventually it will need docs

First draft in 4f2c806!

Has to be done in `init()` instead of `deinit()`, because
there could be a DMA channel still filling the FIFO when
`deinit()` gets called.

Signed-off-by: Dryw Wade <[email protected]>
@mattytrentini

Copy link
Copy Markdown
Contributor

Just adding that I've tested this using the DVI output of the Adafruit Fruit Jam and it worked great!

dvi_fruitjam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HSTX Support for RP2350

3 participants