AnsweredAssumed Answered

STM32L475VG I2C Rx DMA Problem

Question asked by Brian Dahl on Feb 21, 2018

Hi i have a big Problem. 

I have build the HAL with CubeMX 4.24 and i have configured that I2C3 had to Receive 128 Bytes.


static void I2C_ITSlaveCplt(I2C_HandleTypeDef *hi2c, uint32_t ITFlags)


  /* If a DMA is ongoing, Update handle size context */
  if (((hi2c->Instance->CR1 & I2C_CR1_TXDMAEN) == I2C_CR1_TXDMAEN) ||
      ((hi2c->Instance->CR1 & I2C_CR1_RXDMAEN) == I2C_CR1_RXDMAEN))
    hi2c->XferCount = I2C_GET_DMA_REMAIN_DATA(hi2c);

  /* All data are not transferred, so set error code accordingly */
  if (hi2c->XferCount != 0U)
    /* Set ErrorCode corresponding to a Non-Acknowledge */
    hi2c->ErrorCode |= HAL_I2C_ERROR_AF;

When i received a message, then the XferCount on Line 5 are bigger than 0  and the function where left with an Error.

What is wrong??


Best regards