DA7212 MKRZERO Interface

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
9 posts / 0 new
Last post
niradat
Offline
Last seen:1 year 2 months ago
加入:2019-12-27 07:09
DA7212 MKRZERO Interface

Hi,

According to the datasheet of DA7212 Page 62, there is no need of MCLK when DA7212 is interfaced with the processor in slave mode. I have interfaced ard-audio-da7212 board with my Arduino MKRZERO. Arduino MKRZERO is capable of generating the required I2S signals like BCLK,WCLK and DATOUT. My question is do I have to provide MCLK to ard-audio-da7212 from MKRZERO?

当做,

Niradat.

Device:
charlesxue1122
Offline
Last seen:1 day 1 hour ago
Staff
加入:2019-12-23 05:48
亲爱的Niradat,

亲爱的Niradat,

Sorry for the late to response. The DA7212 datasheet of mine seems that have some difference with yours.

Could you send yours to me to check the description. I need check the PLL clock soucrec is from MCLK or BLCK.

许多Thanks!

BR

Charles

niradat
Offline
Last seen:1 year 2 months ago
加入:2019-12-27 07:09
Hi,

Hi,

Attached herewith is the datasheet of DA7212 that I have.

Regards,

Niradat

Attachment:
charlesxue1122
Offline
Last seen:1 day 1 hour ago
Staff
加入:2019-12-23 05:48
Hi Niradat,

Hi Niradat,

Attached is a new one. You can take the section "13.25 Clock modes" as reference. Pls pay attention for Pll mode configuration.

Thanks!

niradat
Offline
Last seen:1 year 2 months ago
加入:2019-12-27 07:09
Hi Charles,

Hi Charles,

Thanks for sharing the updated Datasheet of DA7212. Using the datasheet I have written the follwing code on Arduino MKRZERO. In this code the MKRZERO is playing a 16-bit Stereo WAV file and I can listen it on my ARD-AUDIO-DA7212 Audio Shield. But it seems that DA7212 suddenly goes in sleep state and the audio stops. Although MKRZERO is playing the Audio. Furthermore the Audio from DA7212 Module is not Stereo. Kindly help in this regard.

Best Regards,

涅盘。

#定义编解码器地址0x1A#include#include#include//要播放的wave文件的文件名const char filename[]=“MUSIC.WAV"; // 表示波形文件SDWaveFile waveFile的变量;void setup(){//打开串行通信并等待端口打开:Serial.begin(9600); 延迟(5000);//设置SD卡,取决于您的突破板的屏蔽//您可能需要在开始时为SS传递一个pin码Serial.print(“正在初始化SD卡…”);如果(!SD.begin()) { Serial.println(“初始化失败!”);返回;}Serial.println(“初始化完成。”);//创建一个SDWaveFile waveFile=SDWaveFile(文件名);//如果(!波形{Serial.println(“wave文件无效!”);while(1);//什么都不做}//打印出一些信息。关于wave文件Serial.print(“每采样位数=”);Serial.println(waveFile.bitsPerSample()); 长通道=waveFile.channels(); Serial.print(“频道=”);Serial.println(渠道);长采样率=waveFile.sampleRate(); Serial.print(“采样率=”);Serial.print(采样器);Serial.println(“赫兹”);长持续时间=waveFile.duration(); Serial.print(“持续时间=”);Serial.print(持续时间);Serial.println(“秒”);//////////////////////////////////////////////////////////////////////////////DA7212初始化////////////////////////////////////////////////////////////////////////Wire.begin(); //写入DA7212 0x92 0x00//将斜坡率设置为默认延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x92);Wire.write(0x00);Wire.endTransmission(); //写入DA7212 0x90 0x80//启用数字LDO延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x90);Wire.write(0x80);Wire.endTransmission(); //写入DA7212 0x29 0xC0//启用AIF 16位I2S模式延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x29);Wire.write(0xC0);Wire.endTransmission(); //写入DA7212 0x22 0x0A//设置传入采样率为44.1kHz延时(100);Wire.beginTransmission(编解码器地址);Wire.write(0x22);Wire.write(0x0A);Wire.endTransmission(); //写入DA7212 0x94 0x02//将PC sync设置为resync default delay(100);Wire.beginTransmission(编解码器地址);Wire.write(0x94);Wire.write(0x02);Wire.endTransmission(); //写入DA7212 0x27 0x04//PLL\u CTRL PLL disabled delay(100);Wire.beginTransmission(编解码器地址);Wire.write(0x27);Wire.write(0x04);Wire.endTransmission(); //写入DA7212 0x2A 0x32//路由DAI输出默认延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x2A);Wire.write(0x32);Wire.endTransmission(); //写入DA7212 0x4B 0x08//DACL延迟的混音输入(100);Wire.beginTransmission(编解码器地址);Wire.write(0x48);Wire.write(0x08);Wire.endTransmission(); //写入DA7212 0x4C 0x08//DACR延迟(100)的混音输入;Wire.beginTransmission(编解码器地址);Wire.write(0x4C);Wire.write(0x08);Wire.endTransmission(); //写入DA7212 0x47 0xCD//使能电荷泵、CP\u MOD mode、CPVDD/1和Boost CP delay(100);Wire.beginTransmission(编解码器地址);Wire.write(0x47);Wire.write(0xCD);Wire.endTransmission(); //写入DA7212 0x95 0x36//将CP threshold设置为0x36 delay(100);Wire.beginTransmission(编解码器地址);Wire.write(0x95);Wire.write(0x36);Wire.endTransmission(); //写入DA7212 0x96 0xA5//设置CP Tau DELAY为64ms DELAY(100);Wire.beginTransmission(编解码器地址);Wire.write(0x96);Wire.write(0xA5);Wire.endTransmission(); //写入DA7212 0x48 0x2D//将音量设置为-12dB延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x48);Wire.write(0x2D);Wire.endTransmission(); //写入DA7212 0x49 0x2D//将音量设置为-12dB延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x49);Wire.write(0x2D);Wire.endTransmission(); //写入DA7212 0x51 0xF1//启用DAC、Mix和HP放大器延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0x51);Wire.write(0xF1);Wire.endTransmission(); //写入DA7212 0xFD 0x01//将音调发生器增益设置为-18dBstem有效延迟(100);Wire.beginTransmission(编解码器地址);Wire.write(0xFD);Wire.write(0x01);Wire.endTransmission(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 调整播放音量AudioOutI2S。音量(50);//检查I2S输出是否可以播放波形文件if(!AudioOutI2S.canPlay(波形)){Serial.println(“无法使用I2S播放波形文件!”);while(1);//不执行任何操作}//开始播放Serial.println(“开始播放”);播放(波形);}void loop(){//如果(!AudioOutI2S.isPlaying()){//播放已停止Serial.println(“播放停止”);while(1);//什么也不做}

charlesxue1122
Offline
Last seen:1 day 1 hour ago
Staff
加入:2019-12-23 05:48
Hi Niradat,

Hi Niradat,

If you have decieded to configure DA7212 as slave mode, could you provide the frequency of MCLK/BCLK/WS sent from your Arduino MKRZERO?

I can find some sample code for you.

Thanks!

niradat
Offline
Last seen:1 year 2 months ago
加入:2019-12-27 07:09
Hi Charles,

Hi Charles,

是的,我想要配置DA7212slave mode. Regarding the clock outputs from Arduino MKRZERO, there are only three outputs from MKRZERO namely BCLK, WS and DOUT with their respective frequency BCLK= 1.4112 MHz and WS=44.1KHz. MCLK is not output from MKRZERO.

BCLK= 44.1 kHz × 16 × 2 = 1.4112 MHz

Regards,

Niradat.

charlesxue1122
Offline
Last seen:1 day 1 hour ago
Staff
加入:2019-12-23 05:48
Hi Niradat,

Hi Niradat,

Pls refer the code attached.

Thanks!

niradat
Offline
Last seen:1 year 2 months ago
加入:2019-12-27 07:09
Thanks a lot Charles

Thanks a lot Charles