2024-02-12 12:41 PM
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
Solved! Go to Solution.
2024-02-16 03:29 AM - edited 2024-02-16 04:28 AM
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
2024-02-16 03:29 AM - edited 2024-02-16 04:28 AM
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
2024-02-17 06:02 AM
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?
2024-02-19 12:12 AM
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.