2024-08-26 02:10 PM - last edited on 2024-08-27 08:43 AM by SofLit
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.
Solved! Go to Solution.
2024-08-27 08:46 AM
And try to declare raw variable as global.
2024-08-26 03:11 PM
Please see the posting tips for how to properly post source code:
@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 ?
2024-08-27 08:38 AM
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?
2024-08-27 08:42 AM
Hello @mahmanish and welcome to the community.
You need to use </> button to paste your code.
I'm editing your post then ..
2024-08-27 08:46 AM
And try to declare raw variable as global.
2024-08-27 10:29 AM
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.