cancel
Showing results for 
Search instead for 
Did you mean: 

DFSDM with ADC not responding - STM32L562

MPetr.3
Associate III

Hello Community,

I am trying to post-process my just sampled ADC values with the DFSDM sinc-Filter and mainly the oversampler.

The problem ist: My DFSDM doesn't output anything. I tried DMA and polling.

Polling generates a timeout.

I configured the ADC with a single channel with continuous conversion mode. Polling the ADC value gets me the correct analog value.

I further configured the DFSDM Channel0 as mode=parallel Input, Multiplexer=Data are taken from ADC1, standard data packing.

Furtheremore Filter 1 is configured for channel 0, continuous mode, software trigger, fastsinc, fosr=iosr=1.

I checked the ChannelState (HAL_DFSDM_CHANNEL_STATE_READY) and FilterState (HAL_DFSDM_FILTER_STATE_REG) of the DFSDM, which is fine I think.

So polling generates a timeout and dfsdm start with DMA generates nothing.

Where is my error?

Thanks in advance.

The following shows the beginning of the main.c code just for informative purposes:

/* Private variables ---------------------------------------------------------*/
ADC_HandleTypeDef hadc1;
 
DFSDM_Filter_HandleTypeDef hdfsdm1_filter0;
DFSDM_Channel_HandleTypeDef hdfsdm1_channel0;
DMA_HandleTypeDef hdma_dfsdm1_flt0;
 
/* USER CODE BEGIN PV */
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_ADC1_Init(void);
static void MX_DFSDM1_Init(void);
/* USER CODE BEGIN PFP */
 
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_ADC1_Init();
  MX_DFSDM1_Init();
  /* USER CODE BEGIN 2 */
  uint32_t buf[LEN] = {0};
  HAL_ADC_Start(&hadc1);
  HAL_StatusTypeDef filterstatus = HAL_DFSDM_FilterRegularStart(&hdfsdm1_filter0);
  uint32_t val0 = 0;
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
	  HAL_DFSDM_Filter_StateTypeDef state = HAL_DFSDM_FilterGetState(&hdfsdm1_filter0);
	  uint32_t error = HAL_DFSDM_FilterGetError(&hdfsdm1_filter0);
	  HAL_DFSDM_Channel_StateTypeDef channelstate = HAL_DFSDM_ChannelGetState(&hdfsdm1_channel0);
	  HAL_StatusTypeDef pollstatus = HAL_DFSDM_FilterPollForRegConversion(&hdfsdm1_filter0, 1000);
	  //HAL_ADC_PollForConversion(&hadc1, 1000);
	  uint16_t adval = HAL_ADC_GetValue(&hadc1);
	  val0 = HAL_DFSDM_FilterGetRegularValue(&hdfsdm1_filter0, 0);
	  val0 = buf[0];
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

0 REPLIES 0