HAL_I2C_Mem_Read returns nothing?
I use MAX9611 to measure current. It has 2 register to read current. 12 bits divides 2 bytes. MSB(8 bits) and LSB(4 bits). I tried to read only MSB but I couldn't, Can anyone help me?
Note: there is no externall pull up res, I configure an internal pull up.
I write a simple code. HAL_I2C_IsDeviceReady return HAL_OK. But when I debug HAL_I2C_Mem_Read returns nothing
uint16_t deviceAdress = 0xE1;
uint16_t regAdress = 0x02;
uint8_t CurVal;
void isDeviceReady()
{
HAL_StatusTypeDef status;
status = HAL_I2C_IsDeviceReady(&hi2c1, deviceAdress, 1, 50);
if(status == HAL_OK)
{
return 1;
}
else
return 0;
}
while(1)
{
isDeviceReady();
HAL_GPIO_WritePin(ENABLE_M_GPIO_Port, ENABLE_M_Pin, 1); // Enables mosfet
HAL_I2C_Mem_Read(&hi2c1, deviceAdress, reg_adress, 1, &CurVal, 1, 100);
}https://eu.mouser.com/datasheet/2/609/MAX9611_MAX9612-3131515.pdf
