5 Replies Latest reply on Oct 15, 2018 6:06 AM by alex.lipkovich

    WAV player with SD card on PSoC4, how to use stream read command?

    alex.lipkovich

      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 ?