hello everone,
We are building a project for playing sound samples
To do that we decided to use the pwm output as dac by changing the d.t cycle values while keeping the preiod const.
We set the clock to 4.Mhz and the PWM period to 256 ( all to support our smaples sampling rate and bit per sample)
We are facing a problem making sure that new d.t values are not set before the PWM has finished the current cycle.
To be more clear, the clock rate is much faster then the PWM frequency, resulting in faster then desired d.t update.
example code:
for ( i=0; i<sample_size;i++)
{
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1,data[i]);
}
We tried to read the PWM counter register to sync the d.t update, but unfortunately the counter value is stuck on zero.
any suggestions on the reasom OR maybe a diffrent way to accomplish the above.
thank you very much,
izik