The attached project shows a configuration for the DAC and its functionality is explained in the below points:
- The PDB triggers the next DAC conversion. The DAC features an internal buffer (DAC_DATx) that contains that data to be converted. The DAC data to be converted is determined by an internal pointer. This internal pointer increases or moves to the next element in the buffer on every PDB trigger
- The DAC uses the Data Buffer as normal mode. This means that the buffer works as a circular buffer.
- When the internal pointer reaches some point in the internal buffer, the DMA is triggered and it transfers the new data from an iRAM buffer to the DAC internal buffer.
- In this specific example the DMA treats the source as a circular buffer, because the source buffer size is 512 bytes but the destination (DAC_DATx) buffer is 8 bytes.
The below figure represents the configuration of the example:
The frequency of each output sample is determined by the source frequency of the PDB and the DACINT value.
Sample_Output_Frequency = Source_Frequency/ [(PDB_MULT * PDB_PRESCALER) * (DACINT + 1)]
In the attached example the Bus Clock = 66MHz., PDB_MULT = 1 , PDB_PRESCALER = 128, DACINT = 63
For the 256 elements to convert the frequency of the output signal is 31.47Hz. (Sine Wave)
Original Attachment has been moved to: DAC_DMA.zip