cancel
Showing results for 
Search instead for 
Did you mean: 

I2S Peripheral - Disable slot swapping?

Hello,

Is there a way to disable the slot swapping of the I2S peripheral?

Take the following example, without any HAL_I2S callbacks...

 

void start_loopback(I2S_HandleTypeDef* is2_handle) {
	printf("--> Starting algorithm loop back...\n");

	for (int i=0; i<I2S_FRAME_SAMPLES; i++){
		i2sTxBuffer[i] = i;
	}

	int hal_res = HAL_I2SEx_TransmitReceive_DMA(is2_handle, i2sTxBuffer, i2sRxBuffer, I2S_FRAME_SAMPLES);
	if(hal_res != HAL_OK) {printf("I2S - HAL_I2SEx_TransmitReceive failed, hal_res = %d!\r\n", hal_res); HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_0);}

	while(1){
		vTaskDelay(100);
	}

 

 It unexpectedly produces the following on the receiving end:

 

1 0 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 

 

 

As I'm consuming and producing I2S samples in software, there is no need for the swap, the DMA buffer will already be in an appropriate format to send over the I2S wire.

This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
LCE
Principal II

That looks like some DMA buffer / width mismatch.

Start simple, set all to WORD / 32 bit.

So this ended up being on the receiver side of things, the ESP32:

https://www.esp32.com/viewtopic.php?t=11023

Thanks!