Error in STM32U5 MDF code generation
For a project based on the STM32U585 I use the MDF in a specific configuration.
- Filter 0: receives input from SIT0
- Filter 1 receives input from SIT3
- Filter 3 receives input from SIT0
So three filters are used and only two serial input streams. Serial input stream 1 is not needed and I cannot configure it since the pin of this serial input is used for another function.
It appears that when for a filter a serial input is disabled, the code generation is wrong.
The configuration for filter 1 is shown below:

As said, for filter 1 the serial interface is disabled since this filter is configured to receive its data from serial input stream 3, this is ok.
However, the code generated for MX_MDF1_Init does not specify the configuration setting to tell filter 1 to use stream 3. The generated code for filter 1 is shown below:
/**
MdfHandle1 structure initialization and HAL_MDF_Init function call
*/
MdfHandle1.Instance = MDF1_Filter1;
MdfHandle1.Init.CommonParam.InterleavedFilters = 1;
MdfHandle1.Init.CommonParam.ProcClockDivider = 2;
MdfHandle1.Init.CommonParam.OutputClock.Activation = DISABLE;
MdfHandle1.Init.SerialInterface.Activation = DISABLE;
if (HAL_MDF_Init(&MdfHandle1) != HAL_OK)
{
Error_Handler();
}What is missing is the following line:
MdfHandle1.Init.FilterBistream = MDF_BITSTREAM3_RISING;
So the assumption made by the code generator is that if for a filter its related serial input is disabled, the code for letting it use another input (stream 3 in the code above) is not generated.
