Skip to main content
Associate III
October 26, 2023
Solved

Debugging problem

  • October 26, 2023
  • 3 replies
  • 4192 views
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.
    This topic has been closed for replies.
    Best answer by SRedd.5

    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.

    3 replies

    SRedd.5
    Senior III
    October 26, 2023

    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.

    vishuAuthor
    Associate III
    October 27, 2023

    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

     

    SRedd.5
    SRedd.5Best answer
    Senior III
    October 27, 2023

    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.

    vishuAuthor
    Associate III
    October 27, 2023

    Kindly check image1 . I declared variable as global .

    volatile uint16_t val1; like this

    SRedd.5
    Senior III
    October 27, 2023

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

    vishuAuthor
    Associate III
    October 27, 2023

    Sir check it below attachment .

    SRedd.5
    Senior III
    October 31, 2023

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