cancel
Showing results for 
Search instead for 
Did you mean: 

I2C READ NO RESPONSE

Rohit Rajapure
Associate II
Posted on September 23, 2017 at 07:34

Dear All,

I am configuring I2C for reading EEPROM address.

I am using PB6_I2CSCL and PB7_I2CSDA pin and have connected EEPROM AT24C A2,A1 and A0 pin to GND. 

I have written following code to read the EEPROM but i am unable to read the data.Please suggest me if am missing something in configuration or in reading part.

#define EEPROM_ADDRESS 0xA0 

/* USER CODE BEGIN 3 */

ui8TxData[0]=0x00;

ui8TxData[1]=0x31;

ui8TxData[2]=0x32;

ui8TxData[3]=0x33;

ui8TxData[4]=0x34;

HAL_I2C_Master_Transmit(&hi2c1,EEPROM_ADDRESS,ui8TxData,5,50);

HAL_I2C_Master_Receive(&hi2c1,EEPROM_ADDRESS|0x01,&ui8RxData[0],1,50);

HAL_I2C_Master_Receive(&hi2c1,EEPROM_ADDRESS|0x01,&ui8RxData[1],1,50);

HAL_I2C_Master_Receive(&hi2c1,EEPROM_ADDRESS|0x01,&ui8RxData[2],1,50);

HAL_I2C_Master_Receive(&hi2c1,EEPROM_ADDRESS|0x01,&ui8RxData[3],1,50);

HAL_I2C_Master_Receive(&hi2c1,EEPROM_ADDRESS|0x01,&ui8RxData[5],1,50);

HAL_Delay(100);

Thanks in advance 

Rohit 

1 REPLY 1
Posted on September 23, 2017 at 23:14

Hello!

The appropriate function to read from I2C EEPROM is HAL_I2C_Mem_Write(..) (also in IT and DMA version)

https://community.st.com/0D50X00009XkW1qSAF

is a relative post and

https://community.st.com/0D50X00009Xke3SSAR

is another

regards

vf