cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2S_Receive not returning HAL_OK?

Kcube
Associate

Hi, I'm trying "HAL_I2S_Receive" with the STM32H743, but HAL_OK is not being detected. I wrote 2 different functions - I2SWriteData and I2SReadData. For I2SWriteData, Transmit returns HAL_OK. For I2SReadData, Receive does not return HAL_OK. I2S is set up as a half-master duplex.

static uint32_t I2SWriteData(void)
{
  uint8_t value = 0;
 
  if (HAL_I2S_Transmit(&hi2s1, writeAudioBuffer,  sizeof(writeAudioBuffer), 1000) == HAL_OK)
  {
    value = 1;
  }
  else
  {
    value = 0;
  }
  return value;
}
 
static uint32_t I2SReadData(void)
{
  uint32_t value = 0;
   
  //HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
  if (HAL_I2S_Receive(&hi2s1, &readAudioData, sizeof(readAudioData), 1000) == HAL_OK)
  {
    value = 1;
  }
  else
  {
    value = 0;
  }
  return value;
}

0 REPLIES 0