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

General • Re: Help with PIO fundamentals to drive matrix-based displays.

$
0
0
I have made progress but it's still not right. I have successfully sent DMA to the PIO but it is just shoving it in as fast as it can and ignoring the FIFO buffer. I thought I found the solution with treq_sel, but setting that stops the DMA from sending anything at all.

So I can send the buffer once too fast, or zero times.

Hopefully someone will be able to spot my issue, it hat to be something simple I'm missing at this point!

Code:

@asm_pio(out_shiftdir=rp2.PIO.SHIFT_RIGHT, out_init=(PIO.OUT_LOW), sideset_init=(PIO.OUT_LOW))def strobe_hp_display():    pull(block)        set(x,8)# Send 8 clocked bits    label('loop1')    out(pins, 1) [7] # Send one bit to data pin     nop().side(1) [7]# Clock HI    nop().side(0) [7]# Clock LOW    jmp(x_dec, 'loop1')    wrapPIO0_BASE = 0x50200000TXF0 = 0x010DREQ_PIO0_TX0 = 0a = bytearray(256)for i in range(len(a)-1):    a[i] = i & 0xffsm_hp = StateMachine(0, strobe_hp_display, freq=2000, out_base=Pin(HP_DATA), sideset_base=Pin(HP_CLOCK))sm_hp.active(1)dma = rp2.DMA()ctl = dma.pack_ctrl(size=0, inc_read=True, inc_write=False, ring_sel=False, ring_size=7, treq_sel=DREQ_PIO0_RX0)dma.config(read=a, write=PIO0_BASE+TXF0, count=len(a), ctrl=ctl, trigger=True)dma.active(1)

Statistics: Posted by iansmith6 — Thu Apr 11, 2024 11:12 pm



Viewing all articles
Browse latest Browse all 4061

Trending Articles