cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 DFSDM clipping

_EFrie
Associate III

Any ideas why values would be non linear in the approximately the upper 1 to 2 bits?

For the setup below, it is linear to between -17000 to +14000. Doubling the + output only yields around +18000. These are raw values. This really acts like an overflow somewhere it seems to me. Test input is DC, in this case using an AMC3336 TI modulator.

What am I missing here?

Setup:

static 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 = DISABLE;
  hdfsdm1_filter0.Init.FilterParam.SincOrder = DFSDM_FILTER_SINC3_ORDER;
  hdfsdm1_filter0.Init.FilterParam.Oversampling = 256;
  hdfsdm1_filter0.Init.FilterParam.IntOversampling = 4;
  if (HAL_DFSDM_FilterInit(&hdfsdm1_filter0) != HAL_OK)
  {
    Error_Handler();
  }
  hdfsdm1_channel0.Instance = DFSDM1_Channel0;
  hdfsdm1_channel0.Init.OutputClock.Activation = ENABLE;
  hdfsdm1_channel0.Init.OutputClock.Selection = DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM;
  hdfsdm1_channel0.Init.OutputClock.Divider = 12;
  hdfsdm1_channel0.Init.Input.Multiplexer = DFSDM_CHANNEL_EXTERNAL_INPUTS;
  hdfsdm1_channel0.Init.Input.DataPacking = DFSDM_CHANNEL_STANDARD_MODE;
  hdfsdm1_channel0.Init.Input.Pins = DFSDM_CHANNEL_SAME_CHANNEL_PINS;
  hdfsdm1_channel0.Init.SerialInterface.Type = DFSDM_CHANNEL_SPI_RISING;
  hdfsdm1_channel0.Init.SerialInterface.SpiClock = DFSDM_CHANNEL_SPI_CLOCK_INTERNAL;
  hdfsdm1_channel0.Init.Awd.FilterOrder = DFSDM_CHANNEL_SINC3_ORDER;
  hdfsdm1_channel0.Init.Awd.Oversampling = 1;
  hdfsdm1_channel0.Init.Offset = 0;
  hdfsdm1_channel0.Init.RightBitShift = 11;
  if (HAL_DFSDM_ChannelInit(&hdfsdm1_channel0) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_DFSDM_FilterConfigRegChannel(&hdfsdm1_filter0, DFSDM_CHANNEL_0, DFSDM_CONTINUOUS_CONV_OFF) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DFSDM1_Init 2 */
 
  /* USER CODE END DFSDM1_Init 2 */
 
}

Read:

int32_t readAMC3336(uint32_t samples) {
  int32_t value;
  uint32_t channel = 0;
  HAL_DFSDM_FilterRegularStart(&hdfsdm1_filter0);
  HAL_StatusTypeDef result = HAL_DFSDM_FilterPollForRegConversion(&hdfsdm1_filter0, 10);
  value = HAL_DFSDM_FilterGetRegularValue(&hdfsdm1_filter0, &channel);
  return value;
}

0693W00000QNKABQA5.png

1 ACCEPTED SOLUTION

Accepted Solutions
_EFrie
Associate III

The problem was that the common mode input range was exceeded on the Texas Instrument AMC3336 part, nothing to do with ST micro, but we can leave this alive it doesn't matter.

View solution in original post

3 REPLIES 3
_EFrie
Associate III

I can't delete this post, but its looking like its some other issue.

Hi @Community member​ ,

Could you please explain why you want to delete your post?

If you found the answer to your initial question, please share with us your solution. It will be helpful for other community members.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

_EFrie
Associate III

The problem was that the common mode input range was exceeded on the Texas Instrument AMC3336 part, nothing to do with ST micro, but we can leave this alive it doesn't matter.