Hi everybody
I want to make a wave player with stm32f030k, I read the data correctly fro SD .and I put the data in the buffers,and send to PWM. and read and send ping pong data.
the PWM Combination circuit is composed of two resitors: 1M and 3.9K ,The larger resistor is connected to LSB PWM output channel while the smaller resistor is connected to MSB PWM channel.
the Timer 14 adjusted to interrupt for sample rate 44100HZ.
the timer 3 adjusted for PWM generate in channel 1 and 2 for left channel , the prescaler register is 255.
the MCU clock is 48MHZ .
for test,I generate sine wave with Audacity program with sample rate 44100 and f=500HZ.
The combined output of both channels is links below:
https://youtu.be/ZwDEqyVHno4
https://youtu.be/bOgQmuo64mM
this is main code:
int main(void)
{
myfres=disk_initialize(0);
myfres=f_mount(0, &fs);
myfres=f_open(&myfile,"6.wav",FA_READ);
myfres=f_read(&myfile,&sai_buf[0],sample_no,&bt);
HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_2);
HAL_TIM_Base_Start_IT(&htim14);
The image of combined output of both channels is attachment below:
What do you think is the problem???