cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get "Live Expression" to show results in CubeIDE, there are no compile errors.

TFlac
Associate III

I have a design where I am trying to calculate the frequency of an incoming signal. I am using STM32CubeMX 

 and STM32CubeIDE combo. My process is to use "Live Expressions' within DEBUG to see the results. My platform

 is STM32F303RE.

 The code clip below is the CallBack Routine that is defines in my main.h file. The main.c snippet is as

 follows:

  void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)

 {

  if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) // rising edge interrupt

  {

  // read capture value

  IC_Val1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2); // first value

  if (IC_Val1 != 0) // if the value is not 0

  {

  //read second value

  IC_Val2 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3); // falling edge value

  // calculate Duty cycle

  Duty_Cycle = (IC_Val2*100/IC_Val1);

  // calculate frequency

  Frequency = (2*HAL_RCC_GetPCLK2Freq()/IC_Val1);

  // As my timer2 clock is 2X the PCLK1 CLOCK, that's why X2.

  }

  else

  {

Duty_Cycle = 0;

  Frequency = 0;

  }

  }

 }

 The TIM2 setup within MX is:

 0690X00000ARCWjQAP.jpg

 The "Live Expression" window is a shown:

 0690X00000ARCWtQAP.jpg

 I added the PCLK2 HAL READ and LED_State to make sure I am using the tools correctly. These variables 

 are working fine in Live Expression.

 A little professional help here would be highly appreciated.

 Please take a look and see what is stopping these variables from being processed and viewed.

 Thanks 

0 REPLIES 0