2020-07-02 06:42 AM
Hi,
I am trying to write and read 64bytes data to 24LC128 eeprom with code below. For first64 bytes i can write and read clearly but the next values can not be written. What is wrong with me ? Any advises ?
HAL_I2C_Mem_Write(&hi2c1,(uint16_t)0xA0,0x00,I2C_MEMADD_SIZE_16BIT,save1,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Write(&hi2c1,(uint16_t)0xA0,0x0040,I2C_MEMADD_SIZE_16BIT,save2,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Write(&hi2c1,(uint16_t)0xA0,0x0080,I2C_MEMADD_SIZE_16BIT,save3,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Write(&hi2c1,(uint16_t)0xA0,0x00C0,I2C_MEMADD_SIZE_16BIT,save4,0x0040,1000);
HAL_I2C_Mem_Read(&hi2c1,(uint16_t)0xA0,0,I2C_MEMADD_SIZE_16BIT, save1,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Read(&hi2c1,(uint16_t)0xA0,0x0040,I2C_MEMADD_SIZE_16BIT, save2,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Read(&hi2c1,(uint16_t)0xA0,0x0080,I2C_MEMADD_SIZE_16BIT, save3,0x0040,1000);
HAL_Delay(25);
HAL_I2C_Mem_Read(&hi2c1,(uint16_t)0xA0,0x00C0,I2C_MEMADD_SIZE_16BIT, save4,0x0040,1000);
2020-07-02 07:39 AM
check the page size of the EEPROM. It's like a flash sector.
2020-07-02 09:04 AM
Hi,
The page size is 64Bytes according to eeprom datasheet, so i have used "0x0040" for page size. Is it wrong ?
Thanks
2020-07-02 09:35 AM
Should the 16-bit address be big endian? Check the code which byte is sent first. On the wire it should be big endian (high byte goes 1st)
-- pa
2020-07-02 11:24 AM
Ok, i don't have problem for first 64bytes writing and reading, i have problem with second 64bytes and so on. So, if there is problem with 16-bit adress big or low endian, then i would have problem with first 64bytes writing and reading, right?. Any advise ?
Thanks.
2020-07-02 12:52 PM
> So, if there is problem with 16-bit adress big or low endian, then i would have problem with first 64bytes writing and reading, right?
Haven't you noticed that address 0 is same in either big and little endian format? :)
-- pa
2020-07-02 11:32 PM
:face_with_tears_of_joy: I supposed that you mean device address. Yes you are right, but when i changed the memory address big endian and low endian the result is same.
2020-07-03 12:24 PM
Then, use a logic analyzer