cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H725 4 I2S streams

KRega.1
Associate II

Hey Guys,

I'm struggling to figure out how to stream sine waves at a constant frequency for 8 channels. Each channel has its own sine wave frequency. The issue I'm having is how to stream all these at the same time. I created an array for each sine wave frequency. I thought to use DMA, but the issue is that I have to combine two sine waves into one array with different length of samples. So is there a way for the DMA to interleave two arrays of different lengths into one I2S module?

I can't seem to find an answer for this.

I'm happy with just using interrupts (if fast enough) if the DMA will not work. For interrupt function :HAL_I2S_Transmit_IT(), would I be able to use the Tx FIFO from this function to send 2, 16 bit data at once. (left and right sample) for each DAC

0693W00000D02dgQAB.pngInterrupt code would look like the following:

	 while(1)
	 {
		 	HAL_I2S_Transmit_IT(&hi2s1, &NorthSpeakerSamples[NS_S], 1); // these two functions would have to be combined to work properly.
		 	HAL_I2S_Transmit_IT(&hi2s1, &SouthSpeakerSamples[SS_S], 1);
		 	
		 	HAL_I2S_Transmit_IT(&hi2s2, &EastSpeakerSamples[NS_S], 1);// these two functions would have to be combined to work properly.
		 	HAL_I2S_Transmit_IT(&hi2s2, &WestSpeakerSamples[SS_S], 1);
		 			 		 			 	
		 	HAL_I2S_Transmit_IT(&hi2s3, &NorthCoilSamples[NS_S], 1);// these two functions would have to be combined to work properly.
		 	HAL_I2S_Transmit_IT(&hi2s3, &SouthCoilSamples[SS_S], 1);
		 	
		 	HAL_I2S_Transmit_IT(&hi2s6, &NorthCoilSamples[NS_S], 1);// these two functions would have to be combined to work properly.
		 	HAL_I2S_Transmit_IT(&hi2s6, &SouthCoilSamples[SS_S], 1);
	 }
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
	//NS_S, SS_S, ES_S, WS_S ; // NorthSpeaker_Sample, South..etc...
	// NC_S, SC_S, EC_S, WC_S ; // NorthCoil_Sample, South..etc...
	// NS_Snum, SS_Snum, ES_Snum, WS_Snum ; // NorthSpeaker_SampleNumberOfSamples, South..etc...
	// NC_Snum, SC_Snum, EC_Snum, WC_Snum ; // NorthCoil_SampleSampleNumberOfSamples, South..etc...
 
	if(hi2s==hi2s1)
	{		
		if (NS_S<NS_Snum) ++NS_S; else NS_S=0;
		if (SS_S<SS_Snum) ++SS_S; else SS_S=0;
	}
	
 
}

10 REPLIES 10

ok thanks. Looks like I need to study that again. 🙂