cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F412 - I2S(2) Full Duplex With Two Transmit Channels Can't Be Fully Implemented?

tommymc
Associate II

I am developing an audio processor product that requires 8 audio output channels. I intended to use I2S2 and I2S3 for 4 stereo Tx pairs. The other I2S interfaces are used for other functions including audio input channels.

I had to work around the HAL because it does not seem to support I2S Full Duplex with two Tx channels- only supports Tx and Rx in Full Duplex mode.

...But a BIGGER problem is that on I2S2, SPI2_TX (used as I2S2_TX) and I2S_EXT_TX are both mapped to DMA1 Stream 4, so it seems that you can't use DMA for Full Duplex dual Tx channels on I2S2. On I2S3 they are mapped separately so you can. I2S peripherals aren't really usable without DMA.

I had seen another post about a known omission in the DMA stream/channel map matrix shown in the reference manual. Is it possible there is a configuration that can work or am I out of luck?

6 REPLIES 6

> I had to work around the HAL because it does not seem to support I2S Full Duplex with two Tx channels- only supports Tx and Rx in Full Duplex mode.

The expression "fullduplex" is used for communication channels which can transfer information in both directions at the same time, I guess I wouldn't call your case "fullduplex" but something like "twin" or "dual". But that's just unimportant terminology. The thing is, that any "library" (especially if it aims to be "hardware abstract") inevitably implements only a limited subset of the very wide range of possible modes of usage - those which are "the most often used" - and you just want something unusual, so then you are out of luck, no simple clicky for you.

But that's not that important either.

> BIGGER problem

That again boils down to the tradeoff between cost/silicon area/signals physical length = delays and usability. You again hit something not that usual, and the chip designers did not anticipate that mode of usage, so there are no separate channels for the I2S2_EXT_TX and SPI2_TX available. This goes across the whole 'F4 family.

Possible workaround may be to trigger DMA feeding I2S2Ext from a timer. at the cost of one pin - input of timer being connected to bit or wordclock of I2S. Other option is to use one of the SPIs served by DMA2 as a slave outputting the data, again at the cost of externally interconnected clock.

JW

PS. Please change your username to a normal nick.

Piranha
Chief II

I would suggest to consider using SAI in a TDM mode with a corresponding DAC(s). That way software side will also be much simpler, because the data in memory will be formed as a single 8-channel stream. Take a serious look at F446 and whole G4 and F7 series. For example, F730, if suitable, is much cheaper with four times more processing power. (2x frequency and 2x IPC).

tommymc
Associate II
  1. Yes- "Full Duplex" is not the best description for this. I like your "dual" description better. In the ref. manual it always refers to using I2Sx and I2Sx_ext as Full Duplex, but it also says in the manual 26.6.2 "Both I2Sx and I2Sx_ext can be configured as transmitters or receivers. " I just wish they would have mapped DMA separately on the mux. they have empty channel slots so maybe this was an oversight, but you are right this is not the more common usage of an I2S peripheral.
  2. I'm trying to see if I can use an external pin for DMA triggering. The word Clock uses both edges, but maybe I can DMA 32 bits since I am fortunately using 16 bit samples. Thanks for your suggestion.

Wish I could, but I'm locked into DAC that is only compatible with standard I2S.

Timer can input capture (thus trigger DMA) on both edges.

JW

Piranha
Chief II

Even if you can't use TDM, take F446 or something with at least 2 SAI peripherals and use them in standard I2S mode. Each SAI peripheral has two sub-blocks A and B, each of which can work as a Tx or Rx. Clocks can be both synchronous or asynchronous between the sub-blocks and also between the SAI peripherals. Therefore with 2 SAI peripherals you can make 4 standard I2S outputs all perfectly synchronized!

Take a look at this:

https://www.st.com/resource/en/product_training/STM32F7_Peripheral_SAI.pdf