Search found 7 matches

by kreasteve
Tue Feb 01, 2022 11:38 am
Forum: Raspberry Pi microcontroller boards
Topic: "Big" array in sram | DMA/PIO
Replies: 6
Views: 10198

Re: "Big" array in sram | DMA/PIO

Hi Peter, makes sense. Thank you. Now, I attached a example code. The dma is just copying the ring_buffer 4 times into the target_buffer. blablabla... ... dma_channel0.CTRL_TRIG.RING_SIZE = 7 #32 words dma_channel0.CTRL_TRIG.INCR_READ = True #True: after read the adress is incremented by one dma_cha...
by kreasteve
Tue Feb 01, 2022 7:48 am
Forum: Raspberry Pi microcontroller boards
Topic: "Big" array in sram | DMA/PIO
Replies: 6
Views: 10198

Re: "Big" array in sram | DMA/PIO

Re buffers the key is to instantiate them early and to ensure that they remain in scope - perhaps defined as a global. It is certainly possible to create buffers of ~50KiB in size on the Pico. If a large buffer goes out of scope and has to be re-created, you will encounter fragmentation problems. I...
by kreasteve
Wed Jan 26, 2022 1:26 pm
Forum: Raspberry Pi microcontroller boards
Topic: Reading serial data
Replies: 2
Views: 6310

Re: Reading serial data

Hi you could use select.poll https://docs.micropython.org/en/latest/library/select.html?highlight=select#class-poll like: import select import sys import time serial = select.poll() #new select object serial.register(sys.stdin) #register the stdin TIMEOUT = 0 #0 for dont wait, -1 for wait forever, o...
by kreasteve
Wed Jan 26, 2022 11:53 am
Forum: Raspberry Pi microcontroller boards
Topic: pi pico uart interrupt
Replies: 1
Views: 5172

Re: pi pico uart interrupt

Hi ronan,

you can use UART.irq https://docs.micropython.org/en/latest/ ... e.UART.irq
to start a function every time a uart packet is comming in.

You could also take the second core to handle the uart and send back values to the main loop (first core).
by kreasteve
Tue Jan 25, 2022 3:42 pm
Forum: Raspberry Pi microcontroller boards
Topic: "Big" array in sram | DMA/PIO
Replies: 6
Views: 10198

Re: "Big" array in sram | DMA/PIO

Hi Peter, the machine.I2S looks interesting and I'll give it a try. Yes, I'm currently using 32 bit. This is because my PIO statemachine can handle up to 32 bit for each channel. My final goal is to get more experience in using the DMA ring buffer. In this project I want to be able to generate diffe...
by kreasteve
Tue Jan 25, 2022 10:48 am
Forum: Raspberry Pi microcontroller boards
Topic: "Big" array in sram | DMA/PIO
Replies: 6
Views: 10198

Re: "Big" array in sram | DMA/PIO

Ohh, the allocation is not the problem. After hours of playing around I located the problem at the RING_SIZE setting of the DMA channel. For now I can say: The allocation is done right and quickly for a ringbuffer size of 2**5 (8 Words) all is fine for a ringbuffer size of 2**6 and above the error o...
by kreasteve
Tue Jan 25, 2022 8:55 am
Forum: Raspberry Pi microcontroller boards
Topic: "Big" array in sram | DMA/PIO
Replies: 6
Views: 10198

"Big" array in sram | DMA/PIO

Hello! I'm trying to make a I2S sound generator with DMA and PIO. The PIO works so far. If I generate a array.array with a length above 8 words I get in trouble with ... mhm "fragmentation"??? Here is how my code looks like: ring_buffer_size = 8 ring_buffer = array.array('L', (0x80000000 for _ in ra...