cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read voltage measurement inside UCPD monitor

Marosh
Associate III

I have followed this STM wiki tutorial about basic PD Sink. Everything is running according to it, but I am unable to see voltage and current measurement inside UCPD monitor. I have also followed the set-up of debugging button which is working correctly and prints the voltage inside trace. But the measurement graph is unfortunately blank. Where might be the problem?

github: link 

1 ACCEPTED SOLUTION

Accepted Solutions
HFISTM
ST Employee

Hello,

I just had a deep look in your code on GitHub, and it seems you are not incrementing the DPM and GUI timebase.
Please try with adding these lines in your main.c file:

 

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */
  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM2) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */
  USBPD_DPM_TimerCounter();
  GUI_TimerCounter();
  /* USER CODE END Callback 1 */
}​

 

Regards

View solution in original post

3 REPLIES 3
HFISTM
ST Employee

Hello,

I just had a deep look in your code on GitHub, and it seems you are not incrementing the DPM and GUI timebase.
Please try with adding these lines in your main.c file:

 

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */
  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM2) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */
  USBPD_DPM_TimerCounter();
  GUI_TimerCounter();
  /* USER CODE END Callback 1 */
}​

 

Regards

Thanks a lot, this works like a charm. So the problem was that there wasn't any linkage between timer and GUI, so the software couldn't count up the declared interval?

Glad to hear that !
Yes that is right. The HAL tick that is used by the HAL_Delay function an other timeout utilities is based on a 1 ms tick that is incremented by HAL_IncTick. The USBPD MW and the GUI utility also needs their time tracking variable to be incremented, at the same place. In your case you are using a timer as the 1ms tick source, so you will find those 3 function call in the HAL_TIM_PeriodElapsedCallback, called each ms.