This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc3200 ADC data from DMA

Other Parts Discussed in Thread: CC3200

Hi 

I am working on TI cc3200.

I could able to take the 4096 ADC sample in normal mode, but  need to access the DMA by enabling the ADC DMA and take the samples out.

I know, there are some API's such as:-

ADCIntEnable (unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntFlags);

ADCIntRegister (unsigned long ulBase, unsigned long ulChannel, void(*)(void) pfnHandler);

I couldn't able to implement in my code.

Kindly, please help.

Regards,

Sourabh.

  • Hi,

    I am working on TI cc3200.

    In general , we could able to access the 4096 ADC samples form FIFO. 

    I want to access the ADC data from DMA by enabling the ADC DMA.

    We have API's such as :-

    ADCIntEnable (unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntFlags);

    ADCIntRegister (unsigned long ulBase, unsigned long ulChannel, void(*)(void) pfnHandler);

    But , I couldn't able to implement them in my code.

    Kindly, requesting for help 

    Regards,

    Sourabh.

  • Hi Sourabh,

    In the thread below i have put code snippet you can use to setup DMA along with ADC. Note that here DMA is set in Ping-Pong mode.
    e2e.ti.com/.../408687

    Thanks and Regards,
    Siddaram
  • Hi Siddaram,
    Thanks for the reply !!!

    I need to access the ADC samples using DMA in basic mode.
    I tried by enabling the DMA on ADC , and then reading FIFO data , but its giving some garbage values , Timestamp has totally gone bad.

    If you have sample code for it, will be very helpful.

    Regards,
    Sourabh.
  • Hi Sourabh,

    I have setup ADC in DMA BASIC_MODE using the code below, It works fine.
    Note that i have removed the comments from code below just to make it compact.This code is based on adc example in SDK.

    unsigned long      DmaDataDump[640];
    void ADCIntHandler(void)
    {
      unsigned short Status,i;
      ADCDMADisable(ADC_BASE, ADC_CH_2);  
      Status = ADCIntStatus(ADC_BASE, ADC_CH_2);
      ADCIntClear(ADC_BASE, ADC_CH_2,Status|ADC_DMA_DONE);
      for(i=0;i<640;i++)
      UART_PRINT("\n\rVoltage in mV is %d\n\r",((((DmaDataDump[i] >> 2 ) & 0x0FFF))*1400)/4096);   
      UDMASetupTransfer(UDMA_CH16_ADC_CH2, UDMA_MODE_BASIC, 640, UDMA_SIZE_32, UDMA_ARB_1, 
                        (void *)(0x4402E874+ADC_CH_2), UDMA_SRC_INC_NONE, (void *)&(DmaDataDump[0]), UDMA_DST_INC_32);
      ADCDMAEnable(ADC_BASE, ADC_CH_2);
    }
      
    void InitAdcDma( void )
    {
      unsigned short Status;
      UDMAInit();
      PinTypeADC(PIN_59,0xFF);
      MAP_uDMAChannelAssign(UDMA_CH16_ADC_CH2);
      UDMASetupTransfer(UDMA_CH16_ADC_CH2, UDMA_MODE_BASIC, 640, UDMA_SIZE_32, UDMA_ARB_1, 
                        (void *)(0x4402E874+ADC_CH_2), UDMA_SRC_INC_NONE, (void *)&(DmaDataDump[0]), UDMA_DST_INC_32);
      ADCDMAEnable(ADC_BASE, ADC_CH_2);
      ADCIntRegister(ADC_BASE, ADC_CH_2,ADCIntHandler);
      Status = ADCIntStatus(ADC_BASE, ADC_CH_2);
      ADCIntClear(ADC_BASE, ADC_CH_2,Status|ADC_DMA_DONE);
      ADCIntEnable(ADC_BASE, ADC_CH_2,ADC_DMA_DONE);
      ADCChannelEnable(ADC_BASE, ADC_CH_2);
      ADCEnable(ADC_BASE);
      while(1);
    }

    Thanks and Regards,

    Siddaram

  • Hi Sourabh,

    Did your queries got answered. If yes please press the "Verify Answer" button to close this thread.

    Thanks and Regards,
    Siddaram
  • Hi Sourabh,

    I am closing this thread, if the issue still exists please open a new thread and add a link to this one for reference

    Thanks and Regards,
    Siddaram
  • Hi Siddaram,

    I'm also dealing with ADC by employing DMA Controller.

    I used the structure that you've mentioned above, however even though the retrieved sample contains actual data part [13:2], It does have a timestamp part ( actually, [31:14] is completely empty.

    I've tried to enable ADC timer by calling  ADCTimerConfig & ADCTimerEnable methods but nothing is changed.

    What could be the reason of this issue?

    Btw this is the setup params of my dma:

    	//fifo register offset
    	// ADC_O_channel0FIFODATA + ADC_CH_2
    	// pvSrcBuf : base addr + fifo register offset
    	UDMASetupTransfer(UDMA_CH16_ADC_CH2,
    			UDMA_MODE_BASIC,
    			1,
    			UDMA_SIZE_32,
    			UDMA_ARB_1,
    			(void *)(ADC_BASE + ADC_O_channel0FIFODATA + ADC_CH_2),//(void *)(0x4402E874 + ADC_CH_2),
    			UDMA_SRC_INC_NONE,
    			(void *)&(DmaDataDump[0]),
    			UDMA_DST_INC_32);