Audio data transmitted per second is less than the required number

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ViKu_2048416
Level 4
Level 4
50 sign-ins 25 replies posted 25 sign-ins

Hi,

I am training to transmit the 16 bit, Mono channel audio data at 48KHz from SPI interface to USB host. For this I am using Single channel DMA in a infinite for(;;) loop as follows,

for(;;)

{

//Get buffer

//Memcopy for audio data

//Commit buffer

}

Number of bytes to be transferred per sec is 2(16 bit) * 48000 = 96000. But from the above sequence I can only transfer the ~85000 (i.e. A counter variable is incremented after every DMA commit). Please help me to achieve the required number.

Thanks and Regards,

Vignesh Kumar R.

0 Likes
1 Solution

Hello Vignesh Kumar,

Please use a CONS event notification in the DMA channel creation. In the callback function for the DMA CONS event, use the GetBuffer() API and the CommitBuffer() API. This method would ensure that the GetBuffer() API is called when the USB endpoint consumes data from the FX3 device. The example implementation can be seen in UsbBulkSourceSink example firmware that comes with the FX3 SDK 1.3.4.

Kindly, test it and let know.

Best regards,

Srinath S

View solution in original post

0 Likes
7 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello Vignesh Kumar,

Please let know the buffer size and the buffer count that you are using.

Also, mention the type of endpoint and the burst length used.

Best regards,

Srinath S

0 Likes

Hi Srinath,

Thanks for your response. I configured as follows,

  1. Buffer Size - 48.
  2. Buffer Count - 10.
  3. Endpoint Type - Isochronous endpoint with servicing interval value as 3 (polling happens twice in a milli sec). Mult and burst length is zero.

Regards,

Vignesh Kumar R.

0 Likes

Hello Vignesh Kumar,

- Can you capture the USB traffic using an analyzer and share the same?

- Also, kindly, check if the CyU3PDmaChannelCommitBuffer() API returns success for all the transactions.

Best regards,

Srinath S

0 Likes

Hi Srinath,

I will share the details that you asked. Before that I want to notice one thing, I am using CYU3P_WAIT_FOREVER in CyU3PDmaChannelGetBuffer(). if I use CYU3P_NO_WAIT I am getting time out error, if I can get buffer continuously then the throughput will get increase. Can you please comment on this.

Best regards,

Vignesh Kumar R.

0 Likes

Hello Vignesh Kumar,

- Please let know the type of DMA channel that is being used as to whether MANUAL (or) AUTO.

- Since you have used the buffer count as 10, buffers will be available for every CyU3PDmaChannelGetBuffer() API call as long as the host application is reading the data continuously. So, CY_U3P_NO_WAIT can be used.

- Also, in case you are using CYU3P_WAIT_FOREVER timeout, the GetBuffer API should not be called inside a callback function. Kindly, ensure this.

Also, please provide the details asked in the previous interaction.

Best regards,

Srinath S

0 Likes

Hi Srinath,

I can achieve the throughput (96000 bytes per second) by increasing the number of buffer count (Buffer count = 100, previously it was 10). But still I cannot use CY_U3P_NO_WAIT in GetBuffer() API, it gives timeout error. Dma configuration is as follows,

  1. Manual DMA channel.
  2. Here I have created a thread for Audio data commit, in that thread only I am using GetBuffer API.

Best Regards,

Vignesh Kumar R.

0 Likes

Hello Vignesh Kumar,

Please use a CONS event notification in the DMA channel creation. In the callback function for the DMA CONS event, use the GetBuffer() API and the CommitBuffer() API. This method would ensure that the GetBuffer() API is called when the USB endpoint consumes data from the FX3 device. The example implementation can be seen in UsbBulkSourceSink example firmware that comes with the FX3 SDK 1.3.4.

Kindly, test it and let know.

Best regards,

Srinath S

0 Likes