Hi,
>This seems to be intended behavior, but i couldn't find any documentation on it.
Well, its not "intended" , its just physically caused : the I2S is variant of a SPI , so only transmit generates the clock and receive happens same time with this clock.
You cannot separate transmit and receive, if you want happen both; it has to be at same time, with the clock and WS clock. You only can do it separate, if you also want to only receive OR transmit .
So use it together, if you want both: > TransmitReceive < is you friend here.
from hell aaa HAL:
/**
* @brief Full-Duplex Transmit/Receive data in non-blocking mode using DMA
* hi2s pointer to a I2S_HandleTypeDef structure that contains
* the configuration information for I2S module
* pTxData a 16-bit pointer to the Transmit data buffer.
* pRxData a 16-bit pointer to the Receive data buffer.
* Size number of data sample to be sent:
* @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
* configuration phase, the Size parameter means the number of 16-bit data length
* in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
* the Size parameter means the number of 16-bit data length.
* @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
* between Master and Slave(example: audio streaming).
* @retval HAL status
*/
HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, const uint16_t *pTxData, uint16_t *pRxData,
uint16_t Size)
{
HAL_StatusTypeDef errorcode = HAL_OK;
+
use circular DMA , with callbacks, so you get continuous streams IN and OUT , and just handle the data in the callbacks , full and half , for putting data and reading a block.
(I have the buffers about 4K x samples size, so about every 40ms get+put a 4K block.)
+
Just start the streams with DMA after program start and never stop them, as I2S is intended for continuous streams.
For doing "stop or pause" just write the send data block full with 0x0000, so output is "mute", zero, without any problems or click noise etc.
+
If any problems with data > 16b , i recommend using the SAI , set to I2S format, not the basic I2S ; the SAI on H7 working perfect .
(With I2S i got problems, if set to 24 or 32b format; if only 16b data used, I2S also was ok.)