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.

ADC FIFO size

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm designing a fast continuous ADC application. I've to acquire a signal array synchronized with two digital clock: one clock for array start (trigger) and the other for single sample (sample clock). So my source generate 256 signal (one every sample clock) starting at the "array start "clock.

I'm planning to solve the problem using:

Array start trigger -> Get 256 sample sync with sample clock -> generate interrupt -> in interrupt function copy and send data -> repeat

This should avoid the use of a double buffered acquisition because the interrupt time should be fast enough to manage the buffer content.

So I need a FIFO od 256 samples. Is this possibile?

At page 683 of the spnu499 manual is written: "The ADC module can support up to 1024 buffers. The device supports a maximum of 64 buffers for both the ADC modules.". What's the difference?  Which one is the right maximum?

Can the ADC FIFO be sized to 256 (or slighlty more) samples?

If no: how to proceed to have a continuous ADC in group of 256 samples? There's something like a double buffered continuous acquisition?

In HalCoGen there are two settings for ADC memory size: one in "ADC Group" (FIFO size) and the other in "ADC Memory". The first seems to accept values hagher then 64 but the seconds seems limited to 64 bytes. Which is the difference?

Is there an example of single continous acquisition similar to the one I need?

Thank you,

Matteo

  • Matteo,

    The ADC FIFO can only hold at most 64 samples. I would like to recommend the following for your application.

    (1) On ADC, set the buffer size to 64, set the buffer threshold at 32, and generate a DMA request when there are 32 samples in the FIFO. Set up ADC to run continuously.

    (2) Set up a buffer in system RAM for 512 samples (assume 16 bit data).

    (3) Set up a DMA channel for a block transfer of 512x16 bit. You will need set up 16 frames. Each frame has 32 element. The frame transfer is triggered by ADC. You need to enable HBC (Half Block Complete) and BTC (Block Transfer Complete) interrupts. You also need to enable autoinit.

    (4) After HBC, you can process the first half of the buffer. After BTC, you can process the second half of the data. DMA will auto restart.

    It is very important to use DMA in order to make efficient use of CPU. It takes 12 VCLK cycles for CPU to complete a LDR instruction from peripheral space.

    Thanks and regards,

    Zhaohong

  • Zhaohong,

    thank you for the precise answer. All is clear ecxept how to setup the ADC for DMA (generate the request, set the threshold).

    Can I enable this setup in HalCoGen?

    Can I setup DMA, system RAM buffer and autoinit in HalCoGen?

    If no: can you post a code snippet to help me?

    Thank you,

    Matteo

  • Matteo,

    For each conversion group, there is a DMA control register. You need to enable the "EV BLK XFER" bit and write 256 in the 'EV Block" field. I am not sure if HALCogen generates function for doing this. You should be able to write your own code using the header file provided by HALCogen.

    Thanks and regards,

    Zhaohong

  • Where can I found a code example of double buffering?

    thank you,

    Matteo

  • Matteo,

    I am attaching a code example for your reference. It is not a complete CCS project, but I think that it has all information you need.

    3833.ADC_DMA.zip

    Thanks and regards,

    Zhaohong