How to use I2C2_SendAcknowledge()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use I2C2_SendAcknowledge()

630 Views
jikehe
Contributor II

How to use I2C2_SendAcknowledge()

Labels (1)
0 Kudos
2 Replies

425 Views
BlackNight
NXP Employee
NXP Employee

For example:

res = I2C2_SendAcknowledge(myDevice, LDD_I2C_ACK_BYTE);

From the help text:

SendAcknowledge - This method send acknowledge/not acknowledge for current receiving byte. This method is available only if control acknowledge bit is enabled.

ANSIC prototype:

      LDD_TError SendAcknowledge(LDD_TDeviceData *DeviceDataPtr, LDD_I2C_TAckType AckType)

  • DeviceDataPtr: Pointer to LDD_TDeviceData - Device data structure pointer returned by Init method.
  • AckType:LDD_I2C_TAckType - Specify type of receiving byte answer.
    LDD_I2C_ACK_BYTE - The values of acknowledge bit correspond to successful byte receiving (receiver send ACK bit value automatically according the I2C specification).
    LDD_I2C_NACK_BYTE - The values of acknowledge bit correspond to not successful byte receiving (receiver send NACK bit value and terminate reception).
  • Return value:LDD_TError - Error code, possible codes:
    ERR_OK - OK
    ERR_DISABLED - The device is disabled.
    ERR_SPEED - This device does not work in the active clock configuration.
    ERR_PARAM_MODE - Invalid acknowledge type answer.

Additionally, you get help with 'Help on Component':

Getting Help on Processor Expert Components | MCU on Eclipse

425 Views
jikehe
Contributor II

volatile bool DataReceivedFlg = FALSE;

volatile bool DataTransmittedFlg = FALSE;

uint8_t OutData[4] = {0x00U, 0x01U, 0x02U, 0x03U};

uint8_t InpData[4];

LDD_TError Error;

LDD_TDeviceData *MyI2CPtr;

int main(void)

{

  PE_low_level_init();

  MyI2CPtr = I2C2_Init(NULL);

  while(1)     

  {

    Error = I2C2_SlaveReceiveBlock(MyI2CPtr, &InpData, 4U);

    if(TRUE == DataReceivedFlg)

    {

        I2C2_SendAcknowledge(MyI2CPtr, LDD_I2C_ACK_BYTE);

        DataReceivedFlg = FALSE;

    }

  }

}

pastedImage_3.png

no ack signal

0 Kudos