This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: AM3358 read/write operations to I2C EEPROM

Other Parts Discussed in Thread: AM3358

Tool/software: TI-RTOS

Hi,

i tried to make use of the i2c bound EEPROM on my custom am3358 board (phytec phycore am335x). It is accessable via I2C id 0x52 and i would like to store configuration data in this EEPROM. 

I run the I2C read from a task with following code:

char i2c_read(int RegAdd, int address, int channel)
{

    uint8_t txBuffer[1] = { RegAdd };
    char rxBuffer[1] = { 0 };
    I2C_Handle handle;
    if (channel == 1)
    {
        handle = i2c_chan1_init();
    }
    else if (channel == 0)
    {
        handle = i2c_chan0_init();
    }
    int16_t transferStatus;
    I2C_Transaction i2cTransaction;
    I2C_transactionInit(&i2cTransaction);

    i2cTransaction.slaveAddress = address;
    i2cTransaction.readBuf = (uint8_t *) &rxBuffer[0];
    i2cTransaction.writeBuf = (uint8_t *) &txBuffer[0];
    i2cTransaction.writeCount = 1;
    i2cTransaction.readCount = 0;
    i2cTransaction.timeout = 100;
    transferStatus = I2C_transfer(handle, &i2cTransaction);
    Task_sleep(100);
    i2cTransaction.readBuf = (uint8_t *) &rxBuffer[0];
    i2cTransaction.writeBuf = (uint8_t *) &txBuffer[0];
    i2cTransaction.writeCount = 0;
    i2cTransaction.readCount = 1;
    i2cTransaction.timeout = 100;
    transferStatus = I2C_transfer(handle, &i2cTransaction);
    I2C_close(handle);
    return rxBuffer[0];
}

The write function follows this schematic:

int16_t i2c_write(char Buf[5], int address, int channel)
{
    I2C_Handle handle;
    if (channel == 1)
    {
        handle = i2c_chan1_init();
    }
    else if (channel == 0)
    {
        handle = i2c_chan0_init();
    }
    int16_t transferStatus;
    I2C_Transaction i2cTransaction;
    I2C_transactionInit(&i2cTransaction);
    i2cTransaction.slaveAddress = address;
    i2cTransaction.readBuf = NULL;
    i2cTransaction.readCount = 0;
    i2cTransaction.writeBuf = (uint8_t *) &Buf[0];
    i2cTransaction.writeCount = 2;
    i2cTransaction.timeout = 2000;
    transferStatus = I2C_transfer(handle, &i2cTransaction);
    I2C_close(handle);
    return transferStatus;
}

My Problem is that neither the write nor the read function proceed succesfuly and i found no other example for writing or reading the eeprom. 

Even when I try to programm the eeprom from within yocto linux with i2cset  i am not successfull. The i2cdump returns lots of 0xFF.

The write enable pin is pulled to gnd via a 10kohm resistor on the phycore SOM. I hope you can help me.

Regards,

Jim

EDIT: Is there any existing driver to store data in non volatile memory, e.g. SPI or nand flash ?