Other Parts Discussed in Thread: AM4377
Hello everyone,
I'm trying to make my custom board based on AM4377 work, most of the things are working fine excet EEPROM:
I'm stuck with trying to make EEPROM WRITE (!) work. When I need to read the info - it works like a charm!
I tried both:
- starterware\examples\i2c\eeprom_read
- i2c_utils.c
Starterware example doesn't produce any error, but also has no effect.
[I2CVUtils] i2c_utils.c -> I2CUtilsWrite() returns error -12 (timeout)
But I don't see it waiting 1 or 3 or 5 sec (whatever timeout I set), it immediately returns -12.
If I set timeout = 0 then it never returns and stuck in this function forever.
Here is how I implement write in starterware:
static int32_t I2cAppEepromWrite(i2cAppEepromRead_t *pEepromCfg)
{
int32_t status = S_PASS;
uint32_t index = 0U;
uint8_t byte;
uint8_t txBuf[128];
uint8_t *pBuf = txBuf;
uint32_t dataLen = pEepromCfg->eepromCfgParams.offsetSize + pEepromCfg->eepromCfgParams.bufLen;
memset(txBuf, 0, sizeof(txBuf));
memcpy(pBuf, pEepromCfg->eepromCfgParams.pOffset, pEepromCfg->eepromCfgParams.offsetSize);
pBuf += pEepromCfg->eepromCfgParams.offsetSize;
memcpy(pBuf, pEepromCfg->eepromCfgParams.pBuf, pEepromCfg->eepromCfgParams.bufLen);
/* Call write function to transmit the offset + data */
status = I2CAppWrite(&pEepromCfg->i2cAppCfgObj,
pBuf,
dataLen);
if(S_PASS == status)
{
CONSOLEUtilsPrintf("the data Write to EEPROM is: ");
for(index = 0; index < pEepromCfg->eepromCfgParams.bufLen; index++)
{
/* Collecting the Most Significant Nibble of the data byte. */
byte = *(pEepromCfg->eepromCfgParams.pBuf + index);
CONSOLEUtilsPrintf("%x,", byte);
}
CONSOLEUtilsPrintf("\r\n");
}
return status;
}
I2CAppWrite() is unmodified function from:
C:\ti\pdk_am437x_1_0_14\packages\ti\starterware\examples\i2c\i2c_app.c
I have 2048 bytes EEPROM on my board. I tried to set te board name, version and serial number (starting from offset 0) - only read is working, NO WRITE!
I tried to read/write from offset 0 and 1024 - only read is working, NO WRITE!
For the I2C_utils, right after succesfull read I'm trying to write back and I get the error -12
i2cTxParams.slaveAddr = BOARD_EEPROM_I2C_ADDR_0;
i2cTxParams.pOffset = gEepromOffset;
i2cTxParams.offsetSize = sizeof (gEepromOffset);
i2cTxParams.bufLen = sizeof (boardDataEeprom_t);
i2cTxParams.pBuffer = (uint8_t *) &newBoardDataEeprom;
status = I2CUtilsWrite(i2cInstNum,
&i2cTxParams,
BOARD_I2C_TIMEOUT_VAL);
Could anyone please provide a working example how can I write value to EEPROM and read it back?
Ideally would be example how to set board ID, version and serial. I can read them but I can't change them.
I learned that EEPROM page could be permanently locked to the READ-ONLY mode, I hope this is not my case so I need a reference example which is known to be working, so I can test if my EEPROM writable at all.
I'm trying to make "I2C_Test_evmAM437x_armTestProject" example project work, as it seems this test reading and writing EEPROM, but in my case this project is crashing somewhere on the way, I have to figure out what is wrong with it and in which way it is incompatible with my custom board.
Any help will be very appreciated


