Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4684

General • PIO+DMA w/ offset?

$
0
0
i'm designing an rp2350 custom board capable of interfacing with multiple different older "host" systems running on various cpu's. i want to have bespoke roms for each of those hosts served up from the custom board "on-the-fly" after my board detects which system it's plugged into. i think i want to be using PIO + DMA for this. the PIO i understand, but the DMA is where i'm fuzzy. i think it's something like

Code:

  auto [read_addr_channel, addr_config] = DMACreate(); // claim unused channel, create default config  auto [read_data_channel, read_data_config] = DMACreate(); // claim unused channel, create default config  channel_config_set_dreq(&addr_config, pio_get_dreq(pio0, read_sm, false));  dma_channel_configure(read_addr_channel, &addr_config, &dma_hw->ch[read_data_channel].al3_read_addr_trig,                        &pio0->rxf[read_sm], 1, false);  channel_config_set_transfer_data_size(&read_data_config, DMA_SIZE_8);  channel_config_set_chain_to(&read_data_config, read_addr_channel);  dma_channel_configure(read_data_channel, &read_data_config, &pio0->txf[read_sm], nullptr, 1, false);
_but_ that means the address my host system is looking to read (the one the PIO program provides) is the address it'll read from directly. but that's not where the rom data is. i want the read address "offset" so it'll read from the appropriate rom data, but there's no way i can see to do that. i looked at interpolators but i guess they don't have a way to interact with DMA? one thought i've had is to copy the rom for the given host to address 0 in the flash (turning off xip caching etc.) but i don't know if there's reasons i can't do that (ie the rp2350 needs its own things at 0 in the flash.). are there other options that i'm not aware of yet?

Statistics: Posted by zenzizen — Sun Sep 29, 2024 7:30 pm — Replies 2 — Views 70



Viewing all articles
Browse latest Browse all 4684

Trending Articles