Author Topic: wave player  (Read 796 times)

0 Members and 1 Guest are viewing this topic.

Offline alizare368Topic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: de
wave player
« on: January 01, 2020, 02:41:47 pm »
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:
Code: [Select]
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??? |O
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: wave player
« Reply #1 on: January 02, 2020, 08:27:02 am »
Please do not post repeat topics about the same thing. It causes confusion and annoys people.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf