cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Mem_Read() put's out a write on the STM32G4?

Hello,

if I call the read function it sends a write on the I2C. What am I doing wrong?

Thanks a lot, Best Regards, Seppel

uint8_t i2cData[8U];
uint8_t i2cDevAdr = (0x53 << 1U);
 
HAL_I2C_Mem_Read (&hi2c2, i2cDevAdr , 0x00, 1U, i2cData, 1U, HAL_MAX_DELAY);
 

0693W00000QLoFRQA1.png

1 ACCEPTED SOLUTION

Accepted Solutions

Of course it does, it's a memory/register access command.

It does a I2C W of 8 to 16-bit to the device, and then reverses, and reads the data from the device at that address

The 0x53 is the SLAVE Address of the I2C

The 0x00 is the ADDRESS within the devices address space, ie an EEPROM, FLASH, RTC, etc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

Of course it does, it's a memory/register access command.

It does a I2C W of 8 to 16-bit to the device, and then reverses, and reads the data from the device at that address

The 0x53 is the SLAVE Address of the I2C

The 0x00 is the ADDRESS within the devices address space, ie an EEPROM, FLASH, RTC, etc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks, very true, I was confused,... nearly midnight and I can't get the device to respond,... just gives me a NACK, Signals are good, debugging since hours �� ,... can I delete that useless Post somehow?

Let's not delete things.. damages the forum.

The mechanics of I2C can be confusing at the best of times, and so many devices have odd quirks and behaviours.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..