2025-05-08 1:32 PM
Hello,
I try to use I2S in full duplex mode master with DMA but it doesn't work as expected.
The I2S is configured in 24 bits @32Khz.
DMA TX and RX are configured in half-word circular mode.
I can send data manually but if I loop the input to the output using software, nothing comes out even though there is data on PB4.
DMAs are started with :
HAL_I2S_Transmit_DMA(&hi2s3, I2S_DAC_Buffer, 2);
HAL_I2S_Receive_DMA( &hi2s3, I2S_ADC_Buffer, 2);
I used the function HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s) in main.c like this :
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
I2S_DAC_Buffer[0] = I2S_ADC_Buffer[0];
I2S_DAC_Buffer[1] = I2S_ADC_Buffer[1];
I2S_DAC_Buffer[2] = I2S_ADC_Buffer[2];
I2S_DAC_Buffer[3] = I2S_ADC_Buffer[3];
}
I checked by flashing an LED, the callback function is called as it should.
Why doesn't it work?
I can provide other parts of the code if needed.
2025-05-08 1:41 PM - edited 2025-05-08 1:42 PM
I2S is either a transmitter, or a receiver. It is never both. You have it set as a master transmitter. It cannot receive.
2025-05-08 1:53 PM
2025-05-08 2:06 PM - edited 2025-05-08 2:12 PM
You can use the I2S master transmit + receive, but it happens same time, so you have to use:
HAL_I2SEx_TransmitReceive_DMA(...) .
In callbacks feed the send buffer + read the input buffer, then it will work.
from rm 0316, F303:
ed
Oh, i just see : F301 . :) So use F303 , to have full duplex.