cancel
Showing results for 
Search instead for 
Did you mean: 

Communication STM32F405 with TLV320AIC3104IRHBR

frotaitalos
Associate III

Hi guys, i have a difficult task of communicating the stm32405RGT with a TLV320AIC3104IRHBR, I need to do a simple buffer and pass the guitar signal, process it without any changes and send it to the output again.

I'm actually trying to replicate what "Phil's Lab" did in this series on his YouTube channel: https://www.youtube.com/watch?v=zlGSxZGwj-E

In principle, my hardware is checked and correct, I don't have any problems with my board, but I don't get any signal on the i2s2_sd and i2s2_ext_sd, only on the pins i2s2_ck (1.56MHZ square wave), i2s2_ms (48.8Khz square wave), i2s2_mck ( 12.5Mhz sine wave), these pins are receiving the necessary signals, but nothing happens to the data pins, and I have already made sure that the audio signal has reached the codec correctly.

 

i2s configurator:

 

 

 

static void MX_I2S2_Init(void)
{
 hi2s2.Instance = SPI2;
 hi2s2.Init.Mode = I2S_MODE_MASTER_TX;
 hi2s2.Init.Standard = I2S_STANDARD_PHILIPS;
 hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;
 hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
 hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K;
 hi2s2.Init.CPOL = I2S_CPOL_LOW;
 hi2s2.Init.ClockSource = I2S_CLOCK_PLL;
 hi2s2.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_ENABLE;
if (HAL_I2S_Init(&hi2s2) != HAL_OK)
 {
 Error_Handler();
 }
}

 

 

 

i2c configurator:

 

 

static void MX_I2C2_Init(void)
{
  hi2c2.Instance = I2C2;
  hi2c2.Init.ClockSpeed = 100000;
  hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;
  hi2c2.Init.OwnAddress1 = 0;
  hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
  hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
  hi2c2.Init.OwnAddress2 = 0;
  hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
  hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
  if (HAL_I2C_Init(&hi2c2) != HAL_OK)
  {
    Error_Handler();
  }
}

 

 

 

initialize chip: 

 

 

  GDSP_Codec codec;
  GDSP_Codec_Init(&codec, &hi2c2, CODEC_NRST_GPIO_Port, CODEC_NRST_Pin);
  HAL_Delay(60);
  HAL_StatusTypeDef status = HAL_I2SEx_TransmitReceive_DMA(&hi2s2, (uint16_t *) dacData, (uint16_t *) adcData, BUFFER_SIZE);

 

 

**HAL function return is ok.

dma configurator:

 

 

static void MX_DMA_Init(void)
{
  /* DMA controller clock enable */
  __HAL_RCC_DMA1_CLK_ENABLE();
  /* DMA interrupt init */
  /* DMA1_Stream3_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(DMA1_Stream3_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(DMA1_Stream3_IRQn);
  /* DMA1_Stream4_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(DMA1_Stream4_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(DMA1_Stream4_IRQn);
}

 

 

 

callback's:

 

 

void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{
    inBufPtr = &adcData[0];
    outBufPtr = &dacData[0];
    dataReadyFlag = 1;
}

void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s)
{
    inBufPtr = &adcData[BUFFER_SIZE / 2];
    outBufPtr = &dacData[BUFFER_SIZE / 2];
    dataReadyFlag = 1;
}

 

 

 

process data:

 

 

void processData()
{
                static float leftIn, leftOut;
		static float rightIn, rightOut;

		for(uint8_t n = 0; n < (BUFFER_SIZE/2) - 1; n+=2){

			leftIn = INT16_TO_FLOAT * inBufPtr[n];
			if (leftIn > 1.0f) {
			    leftIn -= 2.0f;
			}
			leftOut = leftIn;

			outBufPtr[n] = (int16_t) (FLOAT_TO_INT16 * leftOut);

			rightIn = INT16_TO_FLOAT * inBufPtr[n+1];

			if (rightIn > 1.0f) {
			    rightIn -= 2.0f;
			}

			rightOut = rightIn;

			outBufPtr[n+1] = (int16_t) (FLOAT_TO_INT16 * rightOut);
		}

		dataReadyFlag = 0;
}

 

 

 

While:

 

 

While(1){
 if(dataReadyFlag)
 {
 processData();
 }
}

 

 

Schematic stm:

frotaitalos_0-1721077847122.png

 

Schematic codec:

frotaitalos_1-1721077911472.png

The i2c pins are in pullup and the other i2s pins are floating (default configuration), but I put the date pins in pullup and they still didn't work. Furthermore, I believe that all the commands when initializing the chipset are correct, as they were taken from the video in question.

Anyway, any brilliant minds out there to help me?

 

0 REPLIES 0