AnsweredAssumed Answered

Do you have the startup code for configuring DA7212 codec on FRDM K66 board?

Question asked by Vishnu S on May 25, 2017
Latest reply on Aug 11, 2017 by Vishnu S

So far, this is what I have tried:

main()

{

I2C_MasterTransferCreateHandle(I2C0, &g_m_handle, i2c_master_callback, NULL);

readcodec();

}

 

readcodec()

{

uint8_t data[2];

i2c_master_config_t masterConfig;

I2C_MasterGetDefaultConfig(&masterConfig);

masterConfig.baudRate_Bps = I2C_BAUDRATE;

sourceClock = CLOCK_GetFreq(I2C0_CLK_SRC);

I2C_MasterInit(I2C0, &masterConfig, sourceClock);

i2c_master_transfer_t masterXfer;
memset(&masterXfer, 0, sizeof(masterXfer));

masterXfer.slaveAddress = 0x1AU;
masterXfer.direction = kI2C_Read;
masterXfer.subaddress = 0x2;
masterXfer.subaddressSize = 0;
masterXfer.data = &data;
masterXfer.dataSize = 1;
masterXfer.flags = kI2C_TransferNoStopFlag;

 

I2C_MasterTransferNonBlocking(I2C0, &g_m_handle, &masterXfer);

/* wait for transfer completed. */
while ((!nakFlag) && (!completionFlag))
{
}

nakFlag = false;

if (completionFlag == true)
{
completionFlag = false;
find_device = true;
}
}

 

This is based out of the Accelerometer demo application that was part of the KSDK bundle.

I am trying to read DA7212's status register. So far, no I2C interrupt itself is getting generated, and the code is stuck at while(!nakFlag). Please help.

 

Is there a sample application for using DA7212 in the FRDM K66 board?

Outcomes