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?
解決済! 解決策の投稿を見る。
Hi Vishnu S
Please download SDK 2.x in the SDK builder here:
Welcome to MCUXpresso | MCUXpresso Config Tools
If you have problems with the download, please check this link:
https://community.nxp.com/docs/DOC-333304
Best Regards
Jorge Alcala
Hi Vishnu S
You could use drivers provided in SDK package, the demo example code and de drivers example code of SAI module have file named fsl_dialog7212.c . Please check this examples codes inside the path <SDK_2.2_FRDM-K66F>\boards\frdmk66f\driver_examples\sai\.
Hope this information could help you.
Best Regards
Jorge Alcala
Hi Jorge,
Thank you for your response.
I am using SDK 2.0 and doesn't have this folder under driver_examples. I am able to find only SDK 2.0 and WolfSSL for Kinetis under www.nxp.com/ksdk. Can you please help me with the link to this SDK 2.2 download?
Thanks.
Hi Vishnu S
Please download SDK 2.x in the SDK builder here:
Welcome to MCUXpresso | MCUXpresso Config Tools
If you have problems with the download, please check this link:
https://community.nxp.com/docs/DOC-333304
Best Regards
Jorge Alcala
Thanks Jorge. I was able to download the SDK and it solved the issues. My codec is up. Sorry for the delay in response.