I am doing an USB Audio device (Speaker) with Cypress/Denebola CX3 platform. The descriptors tell the sampling frequency to be 44.1kHZ and 48kHZ. So during the 'CyFxUacApplnStart', I initialize the I2S port with 44.1KHZ (using CyU3PI2sSetConfig).
When I connect it to PC, it detects as an USB playback device. I am using Audacity tool in Linux. My questions are below.
1) If I select the playback device in Audacity, with a different sampling frequency (say 16kHZ), the I2S has to be reinitialized to 16kHZ instead of 44.1kHZ?
2) If so, how does CX3 get to know what sampling frequency application in host has chosen?
3) If it is over endpoint 0, can u please brief how it is done?
4) Shall the DMA buffer size be modified for different sampling frequency the host choose? Currently I am using 96 bytes for an ISO end point.
Sorry, I cant share the source.
It depends how the host application (Audacity is sending the request to the sampling) . First the device needs to enuerate and show that it can support multiple sampling, which you can do using the descriptors as mentioned in the UAC spec. Next, the host application can select one of the supported sampling rate, else you can provide a default selection. Now whatever the host application select, needs to be conveyed to the device (please check if Audacity supports this and how does it inform the USB device). It can send some setup/class specific request to the device. In the device firmware, you need to check for this event and accordingly create DMA channel/buffers. Please make sure about the command send from the Audacity on changing/selecting one of the sampling rate.