2023-12-11 09:27 AM
I am working with the MDF peripheral and find this to be a great peripheral. However the CubeMX generated code for multiple DMA based filters is not correct.
I am using two filters with DMA and CubeMX generates the following descriptors:
When starting the application I found that both MdfHandle0 and MdfHandle1 refer the same DMA handle, handle_GPDMA1_Channel1. Likewise both handle_GPDMA1_Channel0.Parent and handle_GPDMA1_Channel1.Parent refer the same filter handle, MdfHandle0.
This is caused by generated function HAL_MDF_MspInit which is called when starting a filter using HAL_MDF_AcqStart_DMA. This generated function is executed twice since I use two filters but inside this function the exact same code is executed and no distinction is made whether it is called for filter 0 (MdfHandle0) or filter 1 (MdfHandle1).
In other generated ....MspInit functions a distinction is made based on the peripheral instance the function is called for. For instance for UART's in my code, HAL_UART_MspInit looks like:
...
if(huart->Instance==LPUART1)
{
...;
}
else if(huart->Instance==USART1)
{
...;
}
In order to differentiate between the different UART instances.
This however is not done in HAL_MDF_MspInit. Instead of the above use is made of:
if(IS_MDF_INSTANCE(hmdf->Instance)) which is typically used inside the HAL but not in the generated code and using this no different code is generated for the different filter instances.
The same issue applies to HAL_MDF_MspDeInit.
I have set the wrong descriptors correct manually after the CubeMX initialization code and everything works as expected.
I am using version 6.10.0 of CubeMX and version 1.4.0 of the STM32U5xx HAL library.
Solved! Go to Solution.
2023-12-13 06:25 AM
Hello @LVan .31
Thank you for bringing this issue to our attention, I will check it internally and get back to you as soon as possible.
Thx
Souhaib
2023-12-13 06:25 AM
Hello @LVan .31
Thank you for bringing this issue to our attention, I will check it internally and get back to you as soon as possible.
Thx
Souhaib