cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

alli_264371
New Contributor II

Hi, I need make the wav player on PSoC4 device, but it not so easy..
First I add the FatFs example to my project, i can read the wav file and the setting data, no problem..

Second I true read data with f_read function byte by byte .and put the results to PWM and change the output pin state to see the maximum speed.
And what I see, after 512 byte reads, i see 50msec delay..

Not matter if I read 1 byte or 512 bytes once, if 150Mb or 32Gb SD card, it same delay 50msec between 512bytes  and next 512bytes read..

Yes I can use expensive chip with 16k RAM and make two buffers, but the best solutions it using the same way like the one from SD Player from Chen cite..
So..there presents two version FatFs library ,the small​​ one and the standart​​ ..And the sample wav player build with the small version, with command of stream data read pf_read(0,...) A NULL pointer specifies the streaming read mode

I don't know how it exactly work, but find the asm file (asmfunc.S) ,in timer interrupt make manipulations with FIFO buffer and send data to the UART (I not find how)..
Next step I true to use the same function in my project, but here is the full version of FatFs, and other function to stream read, f_forward..
Even I see the example of make wav player above, but still can't understand how..
Next step I find the source of the function in my project, and it look inactive and work only in AtTiny devices?

anast.png

But if I remove the #if ... I can add the function to the project and make build without errors..the

Maybe anyone know, if can I make stream read on my PSoC4 ?

0 Likes
Reply
1 Solution
alli_264371
New Contributor II

I try to use 8000 samples/sec and two 512bytes buffers, one read and other load data by f_read function, it work, but i see sound with 15Hz click noise, it look like sd card reading disable the interrupt of timer and the PWM periodically can't update the new values..

WINSTAR OLED ,PSOC4 WAV player test - YouTube

It's done
The problem of noise is my mistake

incount++;

PWM_WriteCompare1(Buff1[]);

changed to

PWM_WriteCompare1(Buff1[incount++]);

and reading delay it mistake in the library

#define M_DELAY_US 100 in file sdcard.c ,

changed to 1

and the result here

YouTube

View solution in original post

0 Likes
Reply
5 Replies
alli_264371
New Contributor II

I try to use 8000 samples/sec and two 512bytes buffers, one read and other load data by f_read function, it work, but i see sound with 15Hz click noise, it look like sd card reading disable the interrupt of timer and the PWM periodically can't update the new values..

WINSTAR OLED ,PSOC4 WAV player test - YouTube

It's done
The problem of noise is my mistake

incount++;

PWM_WriteCompare1(Buff1[]);

changed to

PWM_WriteCompare1(Buff1[incount++]);

and reading delay it mistake in the library

#define M_DELAY_US 100 in file sdcard.c ,

changed to 1

and the result here

YouTube

View solution in original post

0 Likes
Reply
alli_264371
New Contributor II

Thanks, but
"4) Insert an empty SD card (upto 2GB size)"
Where can you buy now SD card less of 2Gb?
The my project support up to 32Gb

0 Likes
Reply
AnkitaS_51
Employee

I am sorry to inform that right now we don't have a  officially released component for SD CARD for PSoC4.

0 Likes
Reply
alli_264371
New Contributor II

The FatFs (link in my question) library support up to 32Gb, just need change the delay value in SDCARD.C  file

0 Likes
Reply