This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I2S Master using EasyDMA

Hello.

My application is an I2S Master that transmits audio data to an audio codec. I need to setup a transmit buffer using EasyDMA. Is EasyDMA used by default when using the I2S Master code? If I need to specify using EasyDMA, do I simply instantiate the buffer using:

uint8_t buffer[x] __at__ 0x20000000;

as shown here:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Feasydma.html&cp=4_0_0_3_5

Where do I handle the interrupts that are called using the I2S Master + EasyDMA?

Thanks,

Rob

Parents
  • Hi.

    Is EasyDMA used by default

     Yes Slight smile

    Where do I handle the interrupts that are called using the I2S Master + EasyDMA?

    If you use the I2S driver then you pass a callback handler during initialization of the module that is called by the driver when a I2S interrupt is generated. Have you seen the I2S example in the SDK? It show how the driver is used, it would answer most of your questions.

    regards

    Jared m

  • Hi Jared. Thanks for the response and pointing me to that example. It does help.

    One thing that still isn't clear to me is how the uint32_t p_tx_buffer is organized composed of two 16-bit channels. Are the 16 most significant bits one channel, and the 16 least significant bits the other channel, and are these each uint16_t's? In the example you pointed me to, the tx buffer (m_buffer_tx) is an array, two uint32_t wide, by I2S_DATA_BLOCK_WORDS long. In this case, is one uint32_t the left channel and one uint32_t the right channel, per data word? Or am I mis-understanding the code? 

    I also found an example using Zephyr where the left and right channels were int16_t's so they varied from -0x7fff to +0x7fff.

    Can you elaborate on how the p_tx_buffer is organized? Is each channel a uint16_t or int16_t? 

    Thanks,

    Rob

  • Hi,

     

    RobHel said:
    Are the 16 most significant bits one channel, and the 16 least significant bits the other channel, and are these each uint16_t's?

     Yes, see the 

    prepare_tx_data() function which sets up the initial buffers:
    The reason that both the tx and rx buffers is multiplied is to get double-buffering. Which means that the driver will switch buffers in the callback handler while it process the data, this makes it possible to continue to receive data while the other data is processed. 
    regards
    Jared 
Reply
  • Hi,

     

    RobHel said:
    Are the 16 most significant bits one channel, and the 16 least significant bits the other channel, and are these each uint16_t's?

     Yes, see the 

    prepare_tx_data() function which sets up the initial buffers:
    The reason that both the tx and rx buffers is multiplied is to get double-buffering. Which means that the driver will switch buffers in the callback handler while it process the data, this makes it possible to continue to receive data while the other data is processed. 
    regards
    Jared 
Children
No Data
Related