Skip to content

Add example for SPI with DMA (for reading SPI ADC) #330

Open
@DatanoiseTV

Description

@DatanoiseTV

I am the maker of the PicoADK, a RP2040 powered Audio DSP Board which has a 32-bit Audio DAC and a 8 channel 12-bit SPI ADC with 1 Megasample.

I am trying to get DMA working and to read the 8 channels continuosly (either free-running or at a fixed sample rate),
but with no lack so far.

The code to read a single ADC channel without DMA (ADC128S102 IC) looks as following:

uint16_t adc128_read(uint8_t chan)
{
        if (chan > 7)
                return 0;
        gpio_put(13, 0);
        uint8_t data[2] = {(chan << 3), 0};
        uint8_t rxData[2];
        spi_write_read_blocking(spi1, data, rxData, 2);
        gpio_put(13, 1);
        uint16_t result = (rxData[0] << 8) | rxData[1];

        return result;
}

Hardware Reference: https://github.com/DatanoiseTV/PicoADK-Hardware

Any help would be very appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions