Hi, I'm using STM32L031K6 (Nucleo) and I'm trying to read register on ICM-20948 via I2C but it seems like the master never sends the write bit at the end of the address byte.
I tried HAL_I2C_Master_Transmit, HAL_I2C_Master_Receive, HAL_I2C_Mem_Write, HAL_I2C_Mem_Read and even the DMA functions but nothing works - The 8th bit is always 0 and the ACK is always 1.
Due to the fact that I'm trying to read the WHO_AM_I value of a register 0x00 on device with address 0x68, I'm expecting write operation at the beginning, writing the value of the address of the internal register.
This is my function and printf should print 0xEA.
void I2C_readReg(uint16_t Slave_ADRS, uint8_t Reg_ADRS, uint16_t Size, uint8_t *pBufferRead)
{
uint8_t pBufferWrite[1];
uint16_t MovedAdrs = (uint16_t)(Slave_ADRS<<1);
HAL_I2C_Mem_Read(&hi2c1, MovedAdrs, (uint16_t)Reg_ADRS, (uint16_t)1, pBufferRead, (uint16_t)Size, (uint32_t)I2C_READ_TIMEOUT);
printf("val read %x \n\r", pBufferRead[0]);
}
Where's Slave_ADRS=0x68 and Reg_ADRS=0x00