2017-02-28 11:34 PM
Initial Gencode : CubeMX : V4.19
IDE : KEIL : V5.23.0.0
HW : EEPROM : AT24C16C
minimum board STM32F103C8T6
HSE 72MHz
i pullup SDA, SCL with R 4k7 (PB7 & PB6)
Mode speed 100kHz
// this is my code.. //
my_i2c_status[0] = HAL_I2C_IsDeviceReady( &hi2c1,(uint16_t)0xA1,(uint16_t)10,3000);
my_dat[0] = 10;my_dat[1] = 11;
my_dat[2] = 12;
my_get[0] = 0;my_get[1] = 0;
my_get[2] = 0;
HAL_I2C_Mem_Write( &hi2c1,(uint16_t)0x00A0, (uint16_t)0, (uint16_t)8, my_dat, 3, 3000);HAL_I2C_Mem_Read( &hi2c1,(uint16_t)0x00A1, (uint16_t)0, (uint16_t)8, my_get, 3, 3000);my_get[0] =0 ,
my_get[1] =0 ,
my_get[2] =0 ,
It not change
T_T!
what is mistake in my code.
thank you very much
__/|\__
2017-03-03 09:55 PM
Now, i can solve i2c,
Lib from HAL..
HAL_I2C_Mem_Read() :
Algorythm of HAL_Lib is not mathing with EEPROM, so it can not use
i coding easy functions for solve this problem and oscillope by Saleae Logic Analyzer,i follow timing diagram of RM0008 of STM and data sheet of EEPROM
Now it work..but HAL_I2C_Mem_Write() : it is correct, it can use
thank you every body :)___/\___2017-03-04 07:47 PM
could u please share how u used to work with the eeprom? i have not ur level of knowledge and have been struggling for like 1 week now trying to read and write from an AT24C02 , im using too an
STM32F103C8T6,
i have tested this and many other kind of codes but nothing :S
xBuffer[0] = 'M';
HAL_I2C_Mem_Write(&hi2c1, 0x57, 0x0007, 2, xBuffer, 1, 5); HAL_Delay(10); xBuffer[0] = 0x00; HAL_I2C_Mem_Write(&hi2c1, 0x57, 0x0007, 2, xBuffer, 0, 5); HAL_I2C_Mem_Read(&hi2c1, 0x57, 0x0007, 2, xBuffer, 1, 5);*/HAL_Delay(2000);