AnsweredAssumed Answered

K20 LDD I2C always busy

Question asked by Christopher Chen on Jul 3, 2014
Latest reply on Mar 21, 2015 by Sebastien Pruvost



I'm pretty new to Kinetis chips and Processor Expert and I was having some trouble with using the LDD I2C components. When I'm writing to I2C, it seems like it will never finish writing successfully. I believe I set the I2C component to run at about 95 kHz. Not sure if I set up the component incorrectly in Processor Expert (I don't think so because I was following a tutorial I saw) or I if my user code is erroneous. If anybody could take a look and give some comments that would be greatly appreciated. Thanks!



/*lint -save  -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
  /* Write your local variable definition here */
  LDD_TError myError;
  uint32_t myUserData;
  LDD_TDeviceData* myDeviceData;
  LDD_TData* myDataBufferPtr;
  uint8_t number = 0xFF;
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  myDataBufferPtr = &number;

  myDeviceData = CI2C1_Init(&myUserData);
  if(CI2C1_Enable(myDeviceData) !=  ERR_OK) // Enable I2C, trap potential errors

  CI2C1_MasterSendBlock(myDeviceData, myDataBufferPtr, 2U, LDD_I2C_SEND_STOP);


  myError = CI2C1_MasterSendBlock(myDeviceData, myDataBufferPtr, 2U, LDD_I2C_SEND_STOP);
  case ERR_OK: while(1); break;
  case ERR_DISABLED: while(1); break;
  case ERR_SPEED: while(1); break;
  case ERR_BUSY: break;
  default: while(1);



I can attach my whole project if that would be useful to anybody.