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

Transmitting Sine wave through nRF52840 I2S using Easy DMA with MAX98357A Codec

Hi Nordic Team,
I am developing a device using  Arduino Nano-33-ble board which is based on the nRF52840.
The  code is developed on Arduino IDE and the basic function is to generate  bursts of Sinusoidal wave through I2S via a audio amplifier IC (MAX98357A).
Since I couldn't find support for nRF52 I2S peripheral in the arduino libraries,  I am using the nRF SDK HAL functions as defined in the nRF header files available in the arduino library.   Please find attached the source code that we have developed so far.  The code generates a burst of Sine waves by sending data from a buffer through I2S using DMA.
The issue I am facing is that the  wave output of the  MAX98357A is giving some noise at the start of each burst signal.  
     
The problems identified :

DMA works in  continuous mode only, it doesn't stop  after the i2s transfer completion.  
There is no completion callback for  i2s transfer. TXPTRUPD event occurs only when the data  is copied to the internal hardware buffer.
Can you please help me to reduce this noise seen at the output of codec?
Is there any option to know when the easy dma transmission is completed?
This noise is high when frequency of sine wave reduced.
Kindly refer the attached wave form obtained .
Parents Reply Children
  • Hi Marjeris,

    Sorry I forgot to attach the code.

    I2S_DMA_IRQ_Complete_1.ino

    These are my observation made while implemented I2S with Easy DMA.

    1)Easy DMA is starting over again even after NRF_I2S->TXD.MAXCNT bytes data is finished.
    2)Easy DMA is transmitting continuously until I2S-> TASKS_STOP is set to 1.
    4)Easy DMA in I2S can not be configured to single, block, or burst transfer mode.
    5)Easy DMA can not be configured to circular or linear.


    Please correct if my understandings are wrong. Please provide a solution to the below queries.

    1)1)Can I configure Easy DMA in such a way that DMA transfer is stopped when NRF_I2S->TXD.MAXCNT bytes of data transmission is completed?

    2)Are there any interrupts generated at the completion of Easy DMA transfer? can we configure this?

    3)Is there any generic DMA that can be used along with I2S?

    Please provide an example code if available.

    Best Regards,

    Jesse Wilson 

    Software Engineer

     

  • Hi,

    Sorry for late reply.

    jesse wilson said:
    1)Can I configure Easy DMA in such a way that DMA transfer is stopped when NRF_I2S->TXD.MAXCNT bytes of data transmission is completed?

     Yes, you can use PPI to connect the EVENTS_TXPTRUPD event (which will be generated for every RXTXD.MAXNT words that are sent on the SDOUT pin) with TASKS_STOP on the I2S peripheral. Usually you need to trigger the TASKS_START again afterwards.

     

    jesse wilson said:
    2)Are there any interrupts generated at the completion of Easy DMA transfer? can we configure this?

    You can use the EVENTS_TXPTRUPD event to set an interrupt.

     

    jesse wilson said:
    3)Is there any generic DMA that can be used along with I2S?

     Don't quite understand this question. I2S supports easyDMA and easyDMA is the only DMA module support in Nordic chips.

    BR,

    Marjeris

Related