Issues with I2C Direction Changes
Hello;
I am working with STM32CubeIDE, trying to connect a Nucleo-L4R5ZI board to an ADCS chip using I2C. The method of communication is very strange, requiring: [start condition] - [controller sends two bytes] - [start condition] - [controller sends one byte] - [controller reads several bytes] - [stop condition].

I wrote some code using the built-in HAL functions to try and accomplish this:

while (HAL_I2C_GetState(hi2c) != HAL_I2C_STATE_READY) {} // delay until ready
HAL_I2C_Master_Seq_Transmit_IT(hi2c, ADCS_I2C_ADDRESS << 1, buf, sizeof(buf)/sizeof(uint8_t), I2C_FIRST_AND_NEXT_FRAME);
while (HAL_I2C_GetState(hi2c) != HAL_I2C_STATE_READY) {}
HAL_I2C_Master_Seq_Transmit_IT(hi2c, ADCS_I2C_ADDRESS << 1, read_buf, sizeof(read_buf)/sizeof(uint8_t), I2C_FIRST_AND_NEXT_FRAME);
while (HAL_I2C_GetState(hi2c) != HAL_I2C_STATE_READY) {}
// I2C_FIRST_AND_NEXT_FRAME has start condition, no stop condition, and allows for continuing on with another I2C Seq command
HAL_I2C_Master_Seq_Receive_IT(hi2c, ADCS_I2C_ADDRESS << 1, temp_data, data_length, I2C_LAST_FRAME);
while (HAL_I2C_GetState(hi2c) != HAL_I2C_STATE_READY) {}
This code works perfectly when trying to send data to the chip (the first four lines of code). Unfortunately, it fails to receive any data at all using the last two lines; the peripheral device seems to not even be triggered to send any data, so HAL_I2C_GetState remains in HAL_I2C_STATE_BUSY_RX indefinitely.
Can anyone think of a way to fix this?
Thank you!

