AnsweredAssumed Answered

bug in HAL  I2S Full Duplex  STM32Cube_FW_F4_V1.16.0

Question asked by sea trix on Sep 6, 2017
Latest reply on Sep 14, 2017 by lyon.richard

I'm using I2s2 and I2s2ex in Full Duplex  mode,set the DMA in DMA_CIRCULAR mode,but  HAL_I2SEx_TxRxCpltCallback can't be called,so I modify as follows.Is this a bug?

 

static void I2SEx_TxRxDMACplt(DMA_HandleTypeDef *hdma)
{
I2S_HandleTypeDef* hi2s = (I2S_HandleTypeDef*)((DMA_HandleTypeDef*)hdma)->Parent;

/* if DMA is not configured in DMA_CIRCULAR mode */
if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0U)
{
if (hi2s->hdmarx == hdma)
{
/* Disable Rx DMA Request */
if (((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_MASTER_TX) ||\
((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_SLAVE_TX))
{
CLEAR_BIT(I2SxEXT(hi2s->Instance)->CR2,SPI_CR2_RXDMAEN);
}
else
{
CLEAR_BIT(hi2s->Instance->CR2,SPI_CR2_RXDMAEN);
}

hi2s->RxXferCount = 0U;

if (hi2s->TxXferCount == 0U)
{
hi2s->State = HAL_I2S_STATE_READY;

HAL_I2SEx_TxRxCpltCallback(hi2s);
}
}

if (hi2s->hdmatx == hdma)
{
/* Disable Tx DMA Request */
if (((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_MASTER_TX) ||\
((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_SLAVE_TX))
{
CLEAR_BIT(hi2s->Instance->CR2,SPI_CR2_TXDMAEN);
}
else
{
CLEAR_BIT(I2SxEXT(hi2s->Instance)->CR2,SPI_CR2_TXDMAEN);
}

hi2s->TxXferCount = 0U;

if (hi2s->RxXferCount == 0U)
{
hi2s->State = HAL_I2S_STATE_READY;

HAL_I2SEx_TxRxCpltCallback(hi2s);
}
}
}
else
{
if (hi2s->hdmarx == hdma)
{
hi2s->RxXferCount = 0U;

if (hi2s->TxXferCount == 0U)
{
hi2s->State = HAL_I2S_STATE_READY;

HAL_I2SEx_TxRxCpltCallback(hi2s);
}
}
if (hi2s->hdmatx == hdma)
{

hi2s->TxXferCount = 0U;

if (hi2s->RxXferCount == 0U)
{
hi2s->State = HAL_I2S_STATE_READY;

HAL_I2SEx_TxRxCpltCallback(hi2s);
}
}

}
}

Outcomes