HAL_I2C_Master_Receive
Hello,
I have simple interfacing of STM32F0R8T6 with M24C01 EEPROM. It's been one week I am trying to read from EEPROM but buffer is responding with 0xFF value. My program successfully write values on EEPROM but fails to read them.
My function call:
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_I2C1_Init();uint8_t tab_write[3]= {1,2,3};uint8_t tab_read[3];
HAL_I2C_Master_Transmit(&hi2c1, 0xA0, tab_write, 3, 1000); // device address = 0xA0
HAL_I2C_Master_Receive(&hi2c1, 0xA0, tab_read, 3, 1000);
static void MX_I2C1_Init(void)
{hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x50330309; // 400 Khz hi2c1.Init.OwnAddress1 = 0; hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; hi2c1.Init.OwnAddress2 = 0; hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK; hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;}
I checked some tutorials as well as examples provided by ST by seeing them this code should work but it is not working.
When I use Error_Handler() for both functions it enters error handler of Receive function.
Am I missing something?
Thank you for comments.
#eeprom #stm32f0-i2c #hal_i2c_master_receive