I am trying to implement an ADC driver on a Kinetis MK22FN512M12.
The ADC is configured once and should be hardware triggered by the PIT. The ADC should then send a DMA request on conversion complete to readout the result.
The PIT triggering and ADC conversion seems to run properly. Also the DMA executes one minor loop correctly when I write a '1' to the DMA channel start register:
DMA0->TCD[SYSTEM_AUDIOADC_DMA_CHANNEL].CSR |= DMA_CSR_START(1);
Unfortunately, the ADC DMA request does not seem to work. The DMA Multiplexer is configured as
DMAMUX->CHCFG[SYSTEM_AUDIOADC_DMA_CHANNEL] = 0; DMAMUX->CHCFG[SYSTEM_AUDIOADC_DMA_CHANNEL] |= 28; // for ADC0 DMAMUX->CHCFG[SYSTEM_AUDIOADC_DMA_CHANNEL] |= DMAMUX_CHCFG_ENBL_MASK;
and the ADC is configured to send a DMA request on COCO:
ADC0->SC2 = ADC_SC2_ADTRG_MASK | ADC_SC2_DMAEN_MASK;
The clocks are ungated. The COCO flag is asserted all the time because the result register is never read out. I really don't want to fall back to interrupts (which would work fine btw) for efficiency reasons.
If you need further information about my code, feel free to ask!
Can anyone help me with my
Thank you in advance!