cancel
Showing results for 
Search instead for 
Did you mean: 

Variables are showing nothing in Live expression window

mahmanish
Associate II

Hi Guys,

 

This is my simple ADC program and i was expecting to see some data output on Live expression window. Instead it is showing "Failed to evaluate"

//initialization:

/* USER CODE BEGIN 1 */
uint16_t raw;
char msg[10];

/* USER CODE END 1 */

//while loop
{
//set GPIO Pin high PA8
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
// GEt ADC Value

HAL_ADC_Start(&hadc1);

HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);

raw= HAL_ADC_GetValue(&hadc1);

//convert the string and print

sprintf(msg, "%h\r\n", raw);

HAL_UART_Transmit(&huart3, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

HAL_Delay(1);

/* USER CODE END WHILE */


/* USER CODE BEGIN 3 */

}

 

The same issue is not happening when i am using Black pill board and all live expressions are visible.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

And try to declare raw variable as global.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5

Please see the posting tips for how to properly post source code:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 


@mahmanish wrote:

The same issue is not happening when i am using Black pill board


So what board are you using when the issue does happen ?

Does the correct output appear from your UART ?

Sorry for my ignorance. I am new to this community site.

My board is Nucleo H7A3ZI 144 pin.

Regarding UART, output is appearing jumbled on Terminal (screen shot attached) .

I am not able to evaluate any live expressions. While with same code i am able to see live expressions in my STM F4 black pill board. (screen shot attached).

 

So i belive, i am missing some setting of Nucleo H7A3ZI board and that is creating problem. 

What is your opinion?

Hello @mahmanish and welcome to the community.

You need to use </> button to paste your code.

I'm editing your post then ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
SofLit
ST Employee

And try to declare raw variable as global.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
mahmanish
Associate II

This was too bad for me to see this mistake. I wasted so much time on this. Fianlly everything is in order. 

 

Thank you so much SofLit.