2023-01-22 09:42 PM
hi
i want to write in AT24C512 with stm32f103c8 i send my code.
HAL_I2C_Mem_Write(&hi2c1, 0XA0, 0X11FA,I2C_MEMADD_SIZE_16BIT , &write_data, 1, 100);
For example, I want to put the value of write_data on 0x11FA, and I specify the memory address as 16 bits, but it is always sent as 8 bits, and AT24C512 seems to receive only the first byte of 0x11FA It means AT24C512 receive just 0x11 and its not difference if i set mt address register to 0x1167 0x11FF 0x11A0 all these address is same for AT24C512.
what should I do?
Because I used the module, I am sure the hardware have no problem
2023-01-23 01:19 AM
Hello @ssham.1
A way to write data from a 16 bit address is
HAL_I2C_Mem_Write(&hi2c1, 0XA0, 0x11FA, 2 , &write_data, 1, 100);
regAddr is 16 bit address and "2" is the size in bytes of regAddr= 0x11FA.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-23 04:58 AM
I try it but the result is the same
2023-01-23 10:02 AM
If you are ok with I2C Bit-bang and EEPROM support with a single API (demonstrated with 24256), have a look at this to possibly give you clues.