Manual OUT DMA channel for I2S

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

cross mob
Anonymous
Not applicable

Can you give me a an example which uses Manual out (CY_U3P_DMA_TYPE_MANUAL_OUT) DMA channel (CPU -> I2S Left) to out data to I2S port of CX3? The example I2S project in the sdk did not help me. I need help on specific to Manual Out DMA channel for I2S.

0 Likes
2 Replies
Anonymous
Not applicable

Hi,

In the Example projects, you can find  firmware/dma_examples/cyfxbulklpmaninout. In this you can find the snippet where manual out channel is created as below:

   dmaCfg.size  = size;

    dmaCfg.count = CY_FX_BULKLP_DMA_BUF_COUNT;

    dmaCfg.prodSckId = CY_FX_EP_PRODUCER_SOCKET;

    dmaCfg.consSckId = CY_U3P_CPU_SOCKET_CONS;

    dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

    /* No callback is required. */

    dmaCfg.notification = 0;

    dmaCfg.cb = NULL;

    dmaCfg.prodHeader = 0;

    dmaCfg.prodFooter = 0;

    dmaCfg.consHeader = 0;

    dmaCfg.prodAvailCount = 0;

----------------------------------------------------------------

---------------------------------------------------------------

    /* Create a DMA MANUAL_OUT channel for the consumer socket. */

    dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;

    dmaCfg.consSckId = CY_FX_EP_CONSUMER_SOCKET;

    apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkLpOut,

            CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg);

    if (apiRetStatus != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);

        CyFxAppErrorHandler(apiRetStatus);

    }

In the above code, replace the CY_FX_EP_CONSUMER_SOCKET with CY_U3P_LPP_SOCKET_I2S_LEFT.

You can use this  piece in your CX3 example.

Regards,

- Madhu Sudhan

Anonymous
Not applicable

If I want to use USB audio mono out with CX3, what is the best method among below

a) Auto DMA USB endpoint to I2S Left channel alone, I2S right channel uninitialized.

b) Manual DMA USB endpoint to CPU and from CPU to I2S Left channel alone, I2S right channel uninitialized.

I have tried (a), with I2S continuous mode as below.

    /* Configure the I2S interface. */

    CyU3PMemSet ((uint8_t *)&i2sCfg, 0, sizeof (i2sCfg));

    i2sCfg.isMono = CyTrue;

    i2sCfg.isLsbFirst = CyFalse;

    i2sCfg.isDma = CyTrue;

    i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_CONTINUOUS;

    i2sCfg.sampleRate = CY_U3P_I2S_SAMPLE_RATE_44_1KHz;

    i2sCfg.sampleWidth = CY_U3P_I2S_WIDTH_16_BIT;

    status = CyU3PI2sSetConfig (&i2sCfg, NULL);

    .

    .

    .

    .

    .

    /* Create a DMA Auto channel between two sockets of the

     * U port and the L and R I2S sockets. DMA size is set

     * based on the USB speed. */

    dmaCfg.size = size;

    dmaCfg.count = 4;

    dmaCfg.prodSckId = SOCKET_ID_CX3_UAC_SPK_PRODUCER;

    dmaCfg.consSckId = CY_U3P_LPP_SOCKET_I2S_LEFT;

    dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

    dmaCfg.notification = 0;

    dmaCfg.cb = NULL;

    dmaCfg.prodHeader = 0;

    dmaCfg.prodFooter = 0;

    dmaCfg.consHeader = 0;

    dmaCfg.prodAvailCount = 0;

    status = CyU3PDmaChannelCreate (&glCX3_UAC_I2sLeftCh,

            CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", status);

        CyFxAppErrorHandler(status);

    }

When I stream audio from the host (Android/Linux/Windows), I am hearing a tick noise every 1 second. This can be removed by changing the 'i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_CONTINUOUS; ' as 'i2sCfg.padMode =

CY_U3P_I2S_PAD_MODE_NORMAL; '. But, then there a small background noise along with audio comes.

My descriptors advertise it as 44.1kHZ, 16 bit per sample mono audio device with bInterval=4. Cannot share the descriptor file.

1) What can be the source of such periodic 'tick' noise?

2) What shall be the padMode for I2S setting?

3) Manual DMA or Auto DMA best method people use for USB audio out applications?

4) Any reference code for a working prototype of USB audio out?

0 Likes