Szymon Lagosz

KL25Z i2c issue

Discussion created by Szymon Lagosz on Aug 24, 2013
Latest reply on Dec 11, 2013 by Erich Styger

Hello everyone I have some strange issue with i2c on KL25Z freedom board. I'm using CW with processor expert and using bean I2C_LDD. The problem is that when I want to send several blocks of data on the bus I have to use some delay after sending each block - otherwise I will get ERR_BUSY error and some of blocks will not appear on the bus. See the code of my function:


void MyI2C_SendBlock(uint8_t devAddr, uint8_t *dataBlock, uint8_t dataSize)


   uint8_t res;


    //selecting slave

    I2C_SelectSlaveDevice(I2C_DeviceData, LDD_I2C_ADDRTYPE_7BITS, devAddr);


    //sending data

    res = I2C_MasterSendBlock(I2C_DeviceData, dataBlock, dataSize, LDD_I2C_SEND_STOP);/*


    //wait until data sent

    while (!MyI2C_DataState.dataTransmittedFlag);

    MyI2C_DataState.dataTransmittedFlag = 0;   



    int i;

    for(i = 0; i < 100; ++i);



How to omit using delay?