I've found that if I try to run the HAL_I2C_Mem_Read_DMA() function and communicate with a device with the wrong slave address, it will hang up the I²C bus. It leaves SCL set to 0 because it doesn't send the stop bit. I think this is due to a bug in the HAL library.
I'm using the latest version of the HAL Driver and I find the following code on line 3500 of stm32f4xx_hal_i2c.c:
/* Do not generate a STOP in case of Slave receive non acknowledge during transfer (mean not at the end of transfer) */
if(hi2c->Mode == HAL_I2C_MODE_MASTER)
/* Generate Stop */
The comment is that it doesn't want to generate a STOP for a slave. However, it only checks if hi2c->Mode == HAL_I2C_MODE_MASTER, it does not check if mode == MEM. In my clase, when the slave address is wrong it just finihsed a master write and should send the stop.
The non-DMA function works just fine.