Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I am trying to get samples from two LUTs with chained TDs. The clock signal starts TD0 (from LUT array to register, increase source address) which then starts TD1. Once TD1 is executed, an interrupt is generated to process the samples stored in the registers. For some reason the LED lights up but does not turn off and needless to say, there is no signal on the scope. What am I doing wrong? It has to be something to do with the TD configuration. Thank you for any help in advance.
There are multiple issues with code above. It appears that you want to use interrupt to update VDACs outputs. In such case, using DMA is totally unnecessary, it only slows down the process. Set VDACs values and increment table position directly in the isr.
If you want to use DMA updating VDACs outputs, then interrupt is unnecessary. Since you have 2 independent wave tables and 2 VDACs, I recommend to use 2 separate DMA to push the data. There are no timing advantages in using chained TDs. There is a risk to lose sync between the waves, but it is simple to implement (2 DMAs sharing one clock).
When TDs are chained, the way they execute is: first TD1 pushes all data from Table1, and then passes chain to TD2, which now starts pushing all data from Table2. I believe, this is not you wanted. You wanted one byte from Table1 pushed by TD1, and then one byte byte from Table2 pushed by TD2; and then Table address incremented and cycle repeated again. Unfortunately, chained TDs don't operate that way.
One way to make a synced output of multiple waves was proposed by <pavloven>:
which uses an extra DMA to increment DMA pointer in the joint lookup table, by copying 4-byte data into some intermediate location in RAM, and then distributing each byte into own targets by another DMAs (or chained TDs, if you wish). This guarantees synchronicity, but in expense of the slower output rate.
attached is simple demo project showing synced output of 2 waves (sine and sawtooth) using a pair of VDAC8 and interrupt. Here both waves are stored in FLASH. Their values are written to the VDACs on interrupt. Output frequency = Clock_1 / TableSize (here = 256). The advantage of using interrupt is simplicity, the drawback is lower update rate (typically < 10-50kHz).