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.

C6713 + ADC THS1206 EDMA problem

Other Parts Discussed in Thread: THS1206

Hello,

I want to use EDMA with the DSK6713 and a THS1206 ADC. The software is based on the driver created with the Data Converter Tool. With single block reads it works fine, but I need to read the signal continuously. So I modified the driver to:

1) continuously write to a single buffer

2) continuously write to ping-pong buffers

I applied a sine signal to the analog inputs of the THS1206. Both ways it didn't work and it always looks the same way. As you can see at the plots below it looks like a chopped sine. The first plot shows the whole buffered signal. The second plot is just a closer look at the same buffer as in the first plot.

The configuration I'm using is the following:

    cfgEdmaPing.opt = (unsigned int)(THS1206_EDMAOPT_VALUE | (pAdc->uiIntNum << 16));
    cfgEdmaPing.cnt = (unsigned int)(pAdc->uiFifoLvl | (((ulCount / pAdc->uiFifoLvl) - 1) << 16));
    cfgEdmaPing.src = (unsigned int)pAdc->pBaseAddr;
    cfgEdmaPing.dst = (unsigned int)pDataPing;
    cfgEdmaPing.idx = 0x00000000u;
    cfgEdmaPing.rld = EDMA_RLD_RMK( EDMA_RLD_ELERLD_OF(pAdc->uiFifoLvl),    EDMA_RLD_LINK_OF(pAdc->hDmaPing));

/***************************************************************/
/* DEFINITIONS FOR THE EDMA CHANNEL REGISTERS                  */
/***************************************************************/
/***************************************************************/

/* define for the channel options parameter register OPT       */
/* 0010 1000 0011 0000 0000 0000 0000 0011                     */
/* |||| |||| |||| |||| |||| |||| |||| ||||                     */
/* |||| |||| |||| |||| |||| |||| |||| |||+- FS (yes)           */
/* |||| |||| |||| |||| |||| |||| |||| ||+-- LINK (yes)         */
/* |||| |||| |||| |||| ++++ ++++ ++++ ++--- RESERVED           */
/* |||| |||| |||| ++++--------------------- TCC (set by funct) */
/* |||| |||| |||+-------------------------- TCINT (yes)        */
/* |||| |||| |++--------------------------- DUM (increment)    */
/* |||| |||| +----------------------------- 2DD (no)           */
/* |||| ||++------------------------------- SUM (none)         */
/* |||| |+--------------------------------- 2DS (no)           */
/* |||+-+---------------------------------- ESIZE (16bit)      */
/* +++------------------------------------- PRI (high)         */
/***************************************************************/

#define THS1206_EDMAOPT_VALUE (0x28300003u)

If you need more code or information to help just tell me.

I'm very grateful for every hint or solution I can get.

Regards,

Norman

  • Norman,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages. Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.

    Your statement that you are reading "continuously" is curious to me. What are you using to trigger the EDMA to do a read from the THS1206?

    I do not know this part at all, but usually you get a signal indicating that a conversion has completed and you read it, or you use a timer to tell you when to go read the ADC. Each time you go to read, you read a single sample.

    I notice that the THS1206 has a FIFO, but I have not looked at it in detail. And you use "uiFifoLvl" for Param values, so perhaps you are reading from a FIFO each time? But again, what triggers you to start each EDMA operation?

    What should the pictures look like (other than they should show a sine wave)? What should the amplitude and frequency be? Is the close up correct for the curved part that looks like a portion of a sine wave?

    Right now, you are reading a burst of uiFifoLvl elements each time the EDMA channel is triggered. Is that what you intend? Sorry that I am not more familiar with this ADC that you are using, or my questions might be more like answers.

    Regards,
    RandyP

  • Hi RandyP,

    thank you for your reply.

    As trigger I use an external Interrupt which is connected to the DATA_AV output of the THS1206. DATA_AV generates an interrupt when the buffers is filled with as many samples as I choose with the trigger level. I already tried some trigger levels but I couldn't see any change.

    Well, first things first. I started using the EDMA with a single block read. This works fine as you can see in the plot below. It is also what I expect for my continuous read operation.

    Based on the block transfer I tried to implement the EDMA transfer with linking because I need to read continuously. But as soon as the EDMA transfer is linked back to it self, it only reads this portions this portions of sine wave. The sine wave should have a period of about 28 samples, but I only get portions of 6 to 8 samples. Since this problem always starts when I link the EDMA transfer, I thought something with the linking could be wrong. But so far I haven't figured out what it is exactly.

    To get the information about the EDMA transfer together:

    • reading from a ADC THS1206
    • frame synchronised
    • synchronization through external interrupt which is connected to the ''data available'' signal of the ADC
    • 1D-to-1D transfer
    • works perfectly for a single block read
    • sine wave gets chopped as soon as I link the transfer

    I hope I could make my problem a bit more clear.

    Regards,

    Norman

  • Norman,

    Please go to the TI Wiki Pages and search for "C6713 workshop" (no quotes). We have an archived workshop that you can go through, with labs, that may help you understand how the EDMA works. The EDMA Reference Guide has a good section on Linking EDMA Transfers.

    An EDMA channel does not link to itself, so you are writing your EDMA code wrong. Please go through the training, and use the lab examples as a starting point for your code. There should be additional examples that came with the CSL for the C6713, and those should provide some good examples of the correct way to implement linking.

    Regards,
    RandyP

  • I already read the ''C6713 workshop'' and today I implemented the EDMA transfer like it is done in the workshop.

    I didn't mean that I linked the EDMA channel to itself. I open the EDMA channel and link it to a table and then I link the table to itself.

    Anyways, different approach, same problem. When I try my EDMA configuration with a single block read it works fine. As soon as I link the transfer for auto-initialization I don't receive the correct data anymore.

  • Norman,

    When you implemented the transfer as done in the workshop, did it work and run continuously for you?

    What are the differences in your different approach?

    One method that I have used to debug EDMA problems is to turn off the event mechanism and setup a test loop to send manual events to the EDMA. You can set a breakpoint or single-step through that loop and watch the PARAM to see how it changes as you go through the manual events. It can help to reduce the number of elements in each PARAM set so you do not have to go through 128 samples, or how ever many you are using now.

    Does that sound like a reasonable method to try to find out what is going wrong in your system?

    Regards,
    RandyP

  • RandyP,

    today I got it working. It looks like the problem has something to do with the timer I use to trigger the ADC. I slowed the timer down and it started working. But still its not working perfectly.

    Well, I think I don't completely understand your method of debugging EDMA. How can watch the PARAM? Can I do it with the watch window? I tried it, but I failed. You mean triggering the EDMA with EDMA_setChannel?

    Regards,
    Norman

  • Norman,

    We are very glad you got it working better, but it does sound like you need to do some more work to get it as good as you want it to be.

    Norman Thieme said:
    How can watch the PARAM? Can I do it with the watch window?

    I use the Memory Window, 32-bit TI display mode, with 6 words across the width of the memory window. This way you can see all of a PARAM line at a time. I have to admit that I do not recall doing this with EDMA but only with EDMA3, so I hope I am not misleading you if the PARAM does not get updated. Please let me know how it works.

    Norman Thieme said:
    You mean triggering the EDMA with EDMA_setChannel?

    Yes. In your case, it may be that you use EDMA_setChannel. Perhaps you can stop the timer at a breakpoint, but that may be more programming overhead than you want to do.

    Regards,
    RandyP

  • RandyP,

    thank you for the tip with memory window. It is a great help! I can't see the element count change, but I see the frame count change. One thing is a bit strange to me. I look at the frame count at an interrupt. Since I use frame sync the frame count should either be the configure value or zero, but I get all values between zero and and the configured value. Is it just because the debugger is too slow for EDMA?

    Regards,
    Norman

  • Norman,

    In the EDMA Reference Guide near the beginning, Section 1.2 EDMA Terminology explains the meaning of a Frame-Synchronized Transfer. It details what is updated each time a TR is sent.

    Does the changing memory window match your understanding of that paragraph in Section 1.2?

    Regards,
    RandyP

  • RandyP,

    yes, it works as it is said in section 1.2. I meant the transfer completion interrupt which is explained in Section 1.10. I always look at the memory when a TCINT occurs and the value of FRCNT is always different. Probably it is just a problem of the debugger.

    Regards,
    Norman

  • Norman,

    When you are at the breakpoint in the ISR, if you single-step or refresh the memory window, does the PARAM change? I assume it does, which means that while the debugger has stopped the DSP to allow debug access and memory viewing, the McBSP and EDMA continue to run. This would result in a random capture of the FRCNT field.

    The McBSP SPCR.FREE and SPCR.SOFT control the operation of the McBSP during emulation halt. It is probably best to leave them free-running most of the time. But it could be useful to change them for this testing. I hesitate with that recommendation, however, because the THS1206 is still running all this time, but it may be worth a try to debug this problem.

    Regards,
    RandyP

  • RandyP,

    when I single step through the ISR the PaRAM changes. FRCNT and DST are updated.

    The THS1206 is connected to the EMIF, not to the McBSP. I made the conversion clock very slow and paused it in the ISR. This way I see that the frame syncronization does what it should do. My next steps will be implementing a ping-pong buffer and increasing the frequency of the conversion clock again. Maybe it already works.

    Thank you for your help so far!

    Regards,
    Norman

  • After some more debugging I found out that incoherence of the cache might have have been the problem all the time.

    Anyways, now it works perfectly!