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.

Variable freq sinus in DAC output, uDMA SSI communication

Hello everyone, 

I'm here just to ask for some advice on how to solve some of the requirements on my project, I am relatively new to tivaware and microcontrollers programing in general so I'm just asking for advice from experienced community. I have an tm4c123 microcontroller that sends data to DAC using SSI and uDMA. Requirement for DAC output is sinus signal or square signal according to user setup, also these signals are supposed to be variable frequency, they should change their frequencies according to the value of potentiometer. I managed to got it to work but in order to change signal freq, on user demand, I reinitialise SSI and uDMA with different rate of the clock supplied to the SSI module, and according this value output signal has different freq. Value is set using Tiva api function : 

void SSIConfigSetExpClk(...)

Is this acceptable way to do this? Is it problem for SSI and uDMA be reinitialised several times during electronics operation? Can you suggest me some kind of different approach if mine is wrong. 

  • I have done this on another M4 cores with internal DACs, but it's the same basically. And your approach seem somehow backward to me.

    Rather than reconfiguring the data rate to the DAC each time, just generate the output data on-the-fly, with a sufficient, constant "sample" rate. You know the frequency (of the sinus function, in a mathematical sense), and the index (point in time), so calculating the output value is straight forward. And, you can easily switch to other functions, or value tables.

    BTW, if you require high performance / throughput, avoid using "transcendental" functions like sin(), cos(), etc., even with the FPU. A value-table based method is much faster, and works equally well in the integer realm.