- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I have been trying for a while now to devise a way to play music from an SD card using the PSOC 5LP. I initially have tried to do a direct read from the SD card, save the data into a variable and then write it to a VDAC. However since there is only 1 core i am unable to play sound when i am reading from the SD card thus the audio sounds 'choppy'. I have tried to read into the PSOC ~56kB(8s of audio) however for some strange reason the PSOC stops to work even though I do have the RAM for it =S. So i have settled now for reading in 8kB(1s of audio) as it manages to play for the duration of the song.
I am wondering if it is possible to read data into memory and then use a DMA to directly feed the VDAC, thus allowing the DMA to continuously feed the VDAC and have a better quality of sound. Is this possible and does anyone maybe have some examples of how to set up a DMA to transfer data from a sting to a component like the VDAC?
I have attached my current WIP project for those interested
Thanks for the help!
Stefan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stefan,
Attached is an example of using double-buffered data transfer to VDAC using DMA. Current example implements "software" DDS, generating sine wave of 500 Hz frequency. In short, when half of the RAM buffer is transferred to VDAC, and ISR is fired, requiring to re-fill the data, while next half of the buffer is being transferred to VDAC. Once second half is finished transfer, ISR is fired again, now requiring to populate second half, while first one is being transferred etc. The advantage of such double-buffering is that data is streamed from RAM to VDAC continuously, while process of population the RAM with data can be quite "imperfect" (sporadic). The size of the RAM buffer needs to be large enough to compensate for possible delays in feeding the data, and feeding speed has to be faster than the DMA clock. Max allowed buffer size is 8194 bytes.
In case of playing music, just populate the RAM buffer with your data from Flash card using API provided.
Attached is demo project and associated library (KIT-059).
Please share your project with community if permitted.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These Code example may be useful in your query:
http://www.cypress.com/documentation/code-examples/ce95390-usb-audio-psoc-35lp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stefan,
Attached is an example of using double-buffered data transfer to VDAC using DMA. Current example implements "software" DDS, generating sine wave of 500 Hz frequency. In short, when half of the RAM buffer is transferred to VDAC, and ISR is fired, requiring to re-fill the data, while next half of the buffer is being transferred to VDAC. Once second half is finished transfer, ISR is fired again, now requiring to populate second half, while first one is being transferred etc. The advantage of such double-buffering is that data is streamed from RAM to VDAC continuously, while process of population the RAM with data can be quite "imperfect" (sporadic). The size of the RAM buffer needs to be large enough to compensate for possible delays in feeding the data, and feeding speed has to be faster than the DMA clock. Max allowed buffer size is 8194 bytes.
In case of playing music, just populate the RAM buffer with your data from Flash card using API provided.
Attached is demo project and associated library (KIT-059).
Please share your project with community if permitted.
/odissey1