cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx I2C_TwoBoards_ComDMA Issue

Iirel.1
Associate

In the example

  while(HAL_I2C_Master_Transmit_DMA(&I2cHandle, (uint16_t)I2C_ADDRESS, (uint8_t*)aTxBuffer, TXBUFFERSIZE)!= HAL_OK)
  {
    /* Error_Handler() function is called when Timeout error occurs.
       When Acknowledge failure occurs (Slave don't acknowledge its address)
       Master restarts communication */
    if (HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF)
    {
      Error_Handler();
    }
  }

I want to know why if (HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF) here rather than  if (HAL_I2C_GetError(&I2cHandle) == HAL_I2C_ERROR_AF) if I want to judge Acknowledge failure

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

The explanation is written right there in a code comment!

View solution in original post

1 REPLY 1
Piranha
Chief II

The explanation is written right there in a code comment!