cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging problem

vishu
Associate II
Dear sir,
 
We are working on one of our pharma project in which we want to drive a hall-sensored BLDC motor  using x-nucleo-ihm08m1 board. So we've downloaded firmware provided by ST microelectronics (STM32CubeExpansion_SPN8_V1.0.2) in which we are loading KEIL code on the board.  The value of global variable showing in the watch window shows error i.e cannot evaluate
Please let us know what the problem is and reply to me as soon as possible.
Please find out the attachment below.
1 ACCEPTED SOLUTION

Accepted Solutions

I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes 

This is normal behavior. when you stop executing the code only you can see the variable value. If you want to see the value during run time or without stopping then install cubemonitor software.

The value of variables used in motor control code showing cannot evaluate in watch window.

Same as first what is the kind of the variable if it is Macro, or local variable or optimized you cannot watch the variable value until you stop, you need to define the variable as global variable. From the images you shared i cannot see those varibles.

View solution in original post

9 REPLIES 9
SRedd.5
Senior III

The variable may have been optimized and the compiler may remove that variable as you are not doing anything without variable. You can define that variable as volatile and see the compiler does not optimize it.

first doubt

I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes 

second doubt

The value of variables used in motor control code showing cannot evaluate in watch window.

Please let me  know what the problem is and reply to me as soon as possible.

Thank you

 

I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes 

This is normal behavior. when you stop executing the code only you can see the variable value. If you want to see the value during run time or without stopping then install cubemonitor software.

The value of variables used in motor control code showing cannot evaluate in watch window.

Same as first what is the kind of the variable if it is Macro, or local variable or optimized you cannot watch the variable value until you stop, you need to define the variable as global variable. From the images you shared i cannot see those varibles.

vishu
Associate II

Kindly check image1 . I declared variable as global .

volatile uint16_t val1; like this

i am talking about the voltage_mode and potentiometer in your pain2.png image.

Sir check it below attachment .

It is a Macro and not a variable. It is a pre processor directive before compilation step. Hence it can not be seen in watch window.

Good morning sir,

I  want to debug in keilv5 software. so i dont required cubemonitor software.

SRedd.5
Senior III

I am using the ST Cube ide. i have no idea of Keil software and the related tools.