-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Caution
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum
Describe the set-up
- Custom-Board but also not working on NUCLEO-H753ZI
- STMCubeIDE 1.19.0
- Latest Firmware-Version V1.12.1
Describe the bug
I would like to use a Sigma Delta modulator on the DFSDM input of the STM32H753. This works so far, but if I set a single shot with DMA as configuration, the conversion complete method is only called once. After that the DFSDM does not work anymore because it gets stuck in the state ‘HAL_DFSDM_FILTER_STATE_REG’. This is reproducible.
I think that there might be something missing in the conversion complete method of the DFSDM HAL driver.
I have added the following code to see if it works afterwards. My inserted code fixes the problem, but I am not sure if this is correct at this point or if something is missing.
The hardware driver specialists should take another look at this error and fix it if this is possible.
How To Reproduce
This problem is very easy to reproduce:
1.) First configure a DFSDM Filter, below you can see me code:
` void MX_DFSDM1_Init(void)
{
/* USER CODE BEGIN DFSDM1_Init 0 */
/* USER CODE END DFSDM1_Init 0 */
/* USER CODE BEGIN DFSDM1_Init 1 */
/* USER CODE END DFSDM1_Init 1 /
hdfsdm1_filter0.Instance = DFSDM1_Filter0;
hdfsdm1_filter0.Init.RegularParam.Trigger = DFSDM_FILTER_SW_TRIGGER;
hdfsdm1_filter0.Init.RegularParam.FastMode = DISABLE;
hdfsdm1_filter0.Init.RegularParam.DmaMode = ENABLE;
hdfsdm1_filter0.Init.FilterParam.SincOrder = DFSDM_FILTER_SINC3_ORDER;
hdfsdm1_filter0.Init.FilterParam.Oversampling = 256;
hdfsdm1_filter0.Init.FilterParam.IntOversampling = 1;
if (HAL_DFSDM_FilterInit(&hdfsdm1_filter0) != HAL_OK)
{
Error_Handler();
}
hdfsdm1_channel3.Instance = DFSDM1_Channel3;
hdfsdm1_channel3.Init.OutputClock.Activation = ENABLE;
hdfsdm1_channel3.Init.OutputClock.Selection = DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM;
hdfsdm1_channel3.Init.OutputClock.Divider = 5;
hdfsdm1_channel3.Init.Input.Multiplexer = DFSDM_CHANNEL_EXTERNAL_INPUTS;
hdfsdm1_channel3.Init.Input.DataPacking = DFSDM_CHANNEL_STANDARD_MODE;
hdfsdm1_channel3.Init.Input.Pins = DFSDM_CHANNEL_SAME_CHANNEL_PINS;
hdfsdm1_channel3.Init.SerialInterface.Type = DFSDM_CHANNEL_SPI_RISING;
hdfsdm1_channel3.Init.SerialInterface.SpiClock = DFSDM_CHANNEL_SPI_CLOCK_INTERNAL;
hdfsdm1_channel3.Init.Awd.FilterOrder = DFSDM_CHANNEL_FASTSINC_ORDER;
hdfsdm1_channel3.Init.Awd.Oversampling = 1;
hdfsdm1_channel3.Init.Offset = 0;
hdfsdm1_channel3.Init.RightBitShift = 0x08;
if (HAL_DFSDM_ChannelInit(&hdfsdm1_channel3) != HAL_OK)
{
Error_Handler();
}
if (HAL_DFSDM_FilterConfigRegChannel(&hdfsdm1_filter0, DFSDM_CHANNEL_3, DFSDM_CONTINUOUS_CONV_OFF) != HAL_OK)
{
Error_Handler();
}
/ USER CODE BEGIN DFSDM1_Init 2 */
/* USER CODE END DFSDM1_Init 2 */
} `
- You have only to call:
HAL_DFSDM_FilterRegularStart_DMA(&DFSDM_Filter0Handle, &DFSDM_RawOutput, 1); - Check the ConversionComplete Callback, for example with a break point.
- Call:
HAL_DFSDM_FilterRegularStart_DMA(&DFSDM_Filter0Handle, &DFSDM_RawOutput, 1);again and you will not get into the callback again.
Additional context
I have modified the function static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef *hdma) in stm32h7xx_hal_dfsdm.c as you will see below. This fixes my problem, but as is already said, i am not sure if this is correct, or if the HAL driver specialist have another solution.
`static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef hdma)
{
/ Get DFSDM filter handle /
DFSDM_Filter_HandleTypeDef hdfsdm_filter = (DFSDM_Filter_HandleTypeDef) ((DMA_HandleTypeDef)hdma)->Parent;
/* Call regular conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->RegConvCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterRegConvCpltCallback(hdfsdm_filter);
#endif
/* End of conversion if mode is not continuous and software trigger /
if((hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) &&
(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
{
/ Disable interrupts for regular conversions */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_REOCIE);
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_INJ;
}
}`
If you need any further information, feel fre to ask and i will deliver you the missing information.
Best regards,
Markus
Metadata
Metadata
Assignees
Labels
Type
Projects
Status