Hi everyone,
i am trying to figure out how to set up DMA for moving the ADC results to a variable.
Iam using HET2 to generate triggers for the ADC. This works as iam able to read the data from the buffer0.
But then the ADC should trigger a DMA request to move the data to a variable, which it doesnt...
Does somebody has a hint to get this to work?
uint32 adc1=0; dmaEnable(); g_dmaCTRLPKT1.SADD = (uint32)(&adcREG1->GxBUF[adcGROUP1].BUF0); /*0xFFF4C0B0 source address */ g_dmaCTRLPKT1.DADD = (uint32)(&adc1); // 0x080015EC /* destination address */ g_dmaCTRLPKT1.CHCTRL = 0; /* channel control */ g_dmaCTRLPKT1.FRCNT = 1; /* frame count */ g_dmaCTRLPKT1.ELCNT = 1; /* element count */ g_dmaCTRLPKT1.ELDOFFSET = 0; /* element destination offset */ g_dmaCTRLPKT1.ELSOFFSET = 0; /* element destination offset */ g_dmaCTRLPKT1.FRDOFFSET = 0; /* frame destination offset */ g_dmaCTRLPKT1.FRSOFFSET = 0; /* frame destination offset */ g_dmaCTRLPKT1.PORTASGN = PORTB_READ_PORTA_WRITE; g_dmaCTRLPKT1.RDSIZE = ACCESS_16_BIT; /* read size */ g_dmaCTRLPKT1.WRSIZE = ACCESS_16_BIT; /* write size */ g_dmaCTRLPKT1.TTYPE = FRAME_TRANSFER; /* transfer type */ g_dmaCTRLPKT1.ADDMODERD = ADDR_FIXED; /* address mode read */ g_dmaCTRLPKT1.ADDMODEWR = ADDR_FIXED; /* address mode write */ g_dmaCTRLPKT1.AUTOINIT = AUTOINIT_OFF; /* autoinit dmaReqAssign(DMA_CH10, DMA_REQ10); dmaSetCtrlPacket(DMA_CH10, g_dmaCTRLPKT1); dmaSetChEnable(DMA_CH10, DMA_HW); adcInit(); adcREG1->G1DMACR = 0x00000001; adcStartConversion(adcREG1, adcGROUP1); hetInit(); One funny thing is that the HWCHnENASet seem to be resetted if the HET2 GCR Register is been written.
THe ChnPnd Register of the DMA is 1 at Channel 10.