贤龙 桂

lpi2c driver

Discussion created by 贤龙 桂 on Jul 5, 2017

hello everyone,

       I have one question about lpi2c driver.The S32K144 lpi2c example of S32 design studio can't drive IIC drvice even if I

have modified IIC device address.The device read address is 0xa3 and write address ia 0x2a ,so the slave address is 0x51.

 

   S32 platform software example is below:

 

      LPI2C_DRV_MasterInit(INST_LPI2C1, &lpi2c1_MasterConfig0, &lpi2c1MasterState);

      /* Initialize the data buffer */
      for (i = 0u; i < TRANSFER_SIZE; i++)
      {
         buffer[i] = i;
      }

      /* Send a packet of data to the bus slave */
      LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1, buffer, TRANSFER_SIZE, true, OSIF_WAIT_FOREVER);

       /* Clear the buffer to prepare it for the next operation */
      for (i = 0u; i < TRANSFER_SIZE; i++)
      {
         buffer[i] = 0u;
      }

      /* Request data from the bus slave */
      LPI2C_DRV_MasterReceiveDataBlocking(INST_LPI2C1, buffer, TRANSFER_SIZE, true, OSIF_WAIT_FOREVER);

 

      const lpi2c_master_user_config_t lpi2c1_MasterConfig0 = {
      .slaveAddress = 81U,
      .is10bitAddr = false,
      .operatingMode = LPI2C_FAST_MODE,
      .baudRate = 400000U,
      .transferType = LPI2C_USING_INTERRUPTS,
      .dmaChannel = 0U,
      .masterCallback = NULL,
      .callbackParam = NULL,
      };

      

      Problem is below:

      I set break point before LPI2C_DRV_MasterSendDataBlocking func then run this SW.When the SW stop the break point,I continued to execute one step.I discovered the SW could not run.I don't know what the SW had happened?

      Please help me and thank you a lot!

Outcomes