Reputation: 1
I have a DAC which can be used with a 50MHz SPI interface.Its a 16 bit DAC with 8 bit address,hence i require to send 24 bits data. I want to use Pico to send data to DAC so as to produce a sine wave of 1 kHz with 20 sample (hence sampling rate not more than 20ksps). I used Micropython to program the pico but i am unable to get more than 500 hz wave. What am i doing wrong.....Is there a way to use DMA to speed up this process? also the DAC requires chip select which is not in the machine module so i had to use gpio. whether that is slowing down the process?
Upvotes: 0
Views: 2525
Reputation: 5321
Aside from any other issues, the SPI hardware implementation in the RP2040 only provides automatic control of CSn for transfers of up to 16 bits.
For your case, implementing a simple, 24-bit fixed-format, output-only SPI in the PIO subsystem is quite straightforward, and has the advantage of only requiring a single DMA channel for fully-DMA operation (compared to at least 2 chained DMA channels for a fully-DMA SPI/GPIO approach). The example in the RP2040 datasheet already provides most of the implementation.
Upvotes: 1