cancel
Showing results for 
Search instead for 
Did you mean: 

Error when trying to save a variable in an EEPROM using I2C

Marco S
Associate II
Posted on September 12, 2017 at 14:52

The original post was too long to process during our migration. Please click on the attachment to read the original post.
1 REPLY 1
Marco S
Associate II
Posted on September 13, 2017 at 10:25

I have solved the problem by changing these functions:

HAL_I2C_Mem_Read_DMA(&hi2c1, (uint16_t)EEPROM_ADDRESS, 0, I2C_MEMADD_SIZE_16BIT, (uint8_t *)aRxBuffer, RXBUFFERSIZE)

HAL_I2C_Mem_Write_DMA(&hi2c1 , (uint16_t)EEPROM_ADDRESS, Memory_Address, I2C_MEMADD_SIZE_16BIT, (uint8_t*)(aTxBuffer + Memory_Address), EEPROM_PAGESIZE)

to these ones:

HAL_I2C_Mem_Read(&hi2c1, (uint16_t)EEPROM_ADDRESS, 0, I2C_MEMADD_SIZE_16BIT, (uint8_t *)aRxBuffer, RXBUFFERSIZE, 0x10)

HAL_I2C_Mem_Write(&hi2c1 , (uint16_t)EEPROM_ADDRESS, Memory_Address, I2C_MEMADD_SIZE_16BIT, (uint8_t*)(aTxBuffer + Memory_Address), EEPROM_PAGESIZE, 0x10)

Also, I changed the EEPROM address to: 

#define EEPROM_ADDRESS          (0x50<<1)

I still don't understand why the example proposed by ST doesn't work in with the evaluation board I'm using.