cancel
Showing results for 
Search instead for 
Did you mean: 

ADC on the STM32WL5MOC module not working

JoeGordon
Visitor

Hi Community!

Currently working with the STM32WL5MOC module on my custom board.

I'm trying to work with the ADC but getting values like the fallowing and not changing even when i connect the ADC signal to ground. 

light: 1366
light: 1367
light: 1367
light: 1366
light: 1367

I'm using default configuration for the ADC, and using the STM32cube

this is the code I'm using 

  while (1)
  {
  HAL_ADC_Start(&hadc);
  HAL_ADC_PollForConversion(&hadc, HAL_MAX_DELAY);
     lux = HAL_ADC_GetValue(&hadc);
     sprintf(msg, "light: %hu \r\n",lux);
     HAL_UART_Transmit(&huart2, (uint8_t *)msg, strlen(msg), HAL_MAX_DELAY);
     HAL_Delay(500);
  }

 

Thanks in advance

0 REPLIES 0