cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 i2c eeprom hal

bodnarchuk
Associate
Posted on December 23, 2015 at 15:24

hi, i'm currently learning how to program mcu by means of stm32+cubemx+hal, and i stuck with i2c interface, trying to write a byte to eeprom at24c04 with function

HAL_I2C_Mem_Write(&hi2c1, 0x50, 0x00, 8, &number, 8, 20); 

  * @param  hi2c: pointer to a I2C_HandleTypeDef structure that contains

  *         the configuration information for I2C module

  * @param  DevAddress: Target device address

  * @param  MemAddress: Internal memory address

  * @param  MemAddSize: Size of internal memory address

  * @param  pData: Pointer to data buffer

  * @param  Size: Amount of data to be read

am i doing it right?

Tried expression 

if(HAL_I2C_IsDeviceReady(&hi2c1, 0x50, 20, 500) == HAL_ERROR) HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET);

led turns on immediately. ic connected accordingly to datasheet.

will gladly appreciate any information about my problem
0 REPLIES 0