2021-03-31 12:58 AM
Hello,
i use STM32CubeIDE with FW 1.60 with and want to use the I2C driver with DMA to read and write some data do a device.
I configured it properly in CubeMX and the code has been generated and all interrupts etc. are implemented.
When i test it with a logic analyzer (see attached file) only the WRITE command is send when i use HAL_I2C_Mem_Write_DMA.
while (HAL_I2C_GetState(&i2c_handler) != HAL_I2C_STATE_READY) {
}
//i2c_get_device_response(hi2c4, I2C_JOYSTICK_ADDR_W);
//
// status = HAL_I2C_Mem_Write(&i2c_handler, i2c_dev_address, i2c_dev_register,
// I2C_MEMADD_SIZE_8BIT, (uint8_t*) pBuffer, 1, I2C_DEFAULT_TIMEOUT);
status = HAL_I2C_Mem_Write_DMA(&i2c_handler, i2c_dev_address, i2c_dev_register, I2C_MEMADD_SIZE_8BIT, (uint8_t*) pBuffer, length);
/* Check the communication status */
if (status != HAL_OK) {
printf("** Writing error i2c device: 0x%x.** \n", i2c_dev_address);
I2C4_Reset();
}
It returns HAL_OK but basically, does not send the payload.
Is their any sequence that has tp be followed? Tell me if you need further details to give any recommendation.
Thank you and regards
Clemens