I2S DAC output clock setting

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2S DAC output clock setting

2,149 Views
ruiwangm
Contributor II

Hi,

when I feed the I2S with PCM data, I found the audio speed is much more faster than it should be, but after I modified the board init frequency, it goes slower, I tried from 180MHz to 48MHz(the function I used is BOARD_BootClockFROHF48M/96M, BOARD_BootClockPLL180M();). So, what's the right way to configure the I2S clock? 

Best Regards,

Rui

Labels (3)
0 Kudos
Reply
8 Replies

1,758 Views
jeremyzhou
NXP Employee
NXP Employee

Hi rui wang,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
Before answer your question, I was wondering if you can tell which chip and what demo code you use.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,758 Views
ruiwangm
Contributor II

Hi Jeremy,

I used the i2s_interrupt_transfer demo, but modified some of the code and combined lwip, libmad mp3 decode, emwin and mbedtls.

Thanks.

Best Regards,

Rui.

0 Kudos
Reply

1,758 Views
jeremyzhou
NXP Employee
NXP Employee

Hi rui wang.

Thanks for your reply.

I was wondering if you can describe the steps of replicating the phenomenon and illustrate the sampled output wave,

it will help me to work it out.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,758 Views
ruiwangm
Contributor II

Hi Jeremy, 

Sorry for the late response, I reused the i2s_interrupt_transfer demo from the SDK, and did some modifications.

1, init the i2s device as the demo.

2, use another thread to push the pcm raw data to the i2s peripherial like this:

void audio_data_push(uint8_t* buff, uint32_t len)
{
    status_t stat = kStatus_Fail;
    s_TxTransfer.data = buff;
    s_TxTransfer.dataSize = len;

    while(stat == kStatus_Fail){
      stat = I2S_TxTransferNonBlocking(DEMO_I2S_TX, &s_TxHandle, s_TxTransfer);
      if(stat == kStatus_Fail){
         vTaskDelay(0);
      }
   }
}

and this works good, but after I modify the boot clock, the audio will play abnormally.

BOARD_BootClockFROHF48M();    // too slow
BOARD_BootClockFROHF96M();   //normal
BOARD_BootClockPLL180M();         //too fast

then what other parameters should I set if I modify the demo boot clock?

Thanks.

Best Regards,

Rui

0 Kudos
Reply

1,758 Views
jeremyzhou
NXP Employee
NXP Employee

Hi rui wang,

Thanks for your reply.

Before answer your question, Whether you can tell me which chip and version of SDK you built.

Have a great day,

 

TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,758 Views
ruiwangm
Contributor II

By the way, you can see the project demonstration from eeboard: 2017贸泽电子智造创新大赛 , NO. 16, and give me a vote if you like~

0 Kudos
Reply

1,758 Views
ruiwangm
Contributor II

Hi Jeremy,

the board LPCXpresso54608, OM13092, applied from eeboard, http://www.mouser.cn/new/nxp-semiconductors/nxp-lpcxpresso54608/ 

and the SDK Version: KSDK 2.3.0 (2017-11-16),

I use MCUXpressoIDE_10.1.0_589 environment for the project.

0 Kudos
Reply

1,758 Views
jeremyzhou
NXP Employee
NXP Employee

Hi rui wang,

In the SDK, the clock of I2S is from the audio_pll_clk which is configured in the CLOCK_SetupAudioPLLData(), however

the BOARD_BootClockFROHF48M/96M, BOARD_BootClockPLL180M() are used to configure the SystemCoreClock.

Hope this is clear.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply