about EEprom

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

about EEprom

3,219件の閲覧回数
letseatorange
Contributor III

I would like to use EEPROM to store and read a data, what should I do? if anyone can give a example?

Thanks!

0 件の賞賛
返信
3 返答(返信)

2,820件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Please refer to AN11983 Using the S32K1xx EEPROM Functionality.

 

Regards,

Daniel

0 件の賞賛
返信

2,820件の閲覧回数
guixianlong2008
Contributor I

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!

0 件の賞賛
返信

2,820件の閲覧回数
cheney
Contributor III

First.If you are using the S32K144 EVB, you should set the SDA and SCL to pullup state and slow down the IIC speed.

Second, you should operate the eeprom according to the datasheet.

Here is a example,hope it helps.

typedef union
{
    uint8_t transdata[9];
    struct
    {
        uint8_t addr;
        uint8_t data[8];
    };
}e2p_op;

e2p_op eeptest_op;

{

   /* write eeprom data */

    LPI2C_DRV_MasterInit(INST_LPI2C1, &lpi2c1_MasterConfig0, &lpi2c1MasterState);
    PORT_HAL_SetPullSel(PORTA, 2, PORT_INTERNAL_PULL_UP_ENABLED);
    PORT_HAL_SetPullSel(PORTA, 3, PORT_INTERNAL_PULL_UP_ENABLED);

    eeptest_op.addr = 0;
    for (int var = 0; var < 8; ++var)
    {
        eeptest_op.data[var] = var;
    }

    LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1, eeptest_op.transdata, 4, true, OSIF_WAIT_FOREVER);

   /* read eeprom data */

    OSIF_TimeDelay(10U);
    for (int var = 0; var < 8; ++var)
    {
        eeptest_op.data[var] = 0;
    }
    LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1, &eeptest_op.addr, 1, false, OSIF_WAIT_FOREVER);
    LPI2C_DRV_MasterReceiveDataBlocking(INST_LPI2C1, eeptest_op.data, 3, true, OSIF_WAIT_FOREVER);

}

0 件の賞賛
返信