AnsweredAssumed Answered

KL02 I2C communication with DAC AD5306

Question asked by Andres L. Bleda on May 10, 2016
Latest reply on May 10, 2016 by jeremyzhou

Hi everyone, I hope you can help me with this problem, I have been with this issue during several days and the problem is not solved yet.

I have the FRDM-KL02 board connected with a DAC converter (AD5306) via I2C. I have configured the I2C1 with ports A8 and A9 as SCL and SDA:



#define BOARD_I2C_INSTANCE          1


The KL02 acts as Master and the DAC as slave. The first communication byte has to be the slave address (7 bits) followed by the typical R/W bit. After that, another 3 bytes has to be sent.


I have tried to use the "I2C_DRV_MasterSendDataBlocking" but it does not work fine.

I have debugged the code and when it tries to send the addres byte via I2C (inside the function "I2C_DRV_SendAddress"), the slave address value is not transfered to the I2C1_D register specifically when next function is called:

I2C_HAL_WriteByte(I2C1_BASE_PTR, addrBuff[0]); // addrBuff[0] contains the slave address with the R/W bit = 1


I have checked all the I2C1 registers, and they are correct. The main sequence for the I2C communication in my project is the next one:

// Initialize i2c master


    I2C_DRV_MasterInit(BOARD_I2C_INSTANCE, &master);     //i2c_master_state_t master;


    // Master sends only data to slave (4 bytes: 1 Slave Addres + 1 pointer byte + 2 data bytes)




    // Start transfer with buffer size is 1 byte

    I2C_DRV_MasterSendDataBlockingAD5306(BOARD_I2C_INSTANCE, &device, NULL, 0, (const uint8_t*)txBuff, sizeof(txBuff), 1000);


Do you have any idea of what is happening? Could you suggest me any other way to do it correctly?


Thanks in advance. Waiting your suggestions.