cancel
Showing results for 
Search instead for 
Did you mean: 

Graph is not displaying correctly

nsabo.1
Associate II

Receiving data by UART and display it by TOUCHGFX cause some lost data in my screen, graph is not displayed correctly.

There are 2 boards one which is been receiving the signals by sensors and the second one is LCD board which has been configured by TOUCHGFX.

I want to receive data by UART from the first board and show them in LCD.

But some graph is not shown correctly.

Here is the code:

```

HAL_UART_Receive_IT(&huart1,(uint8_t*)RxBuf,20);

HAL_UART_RxCpltCallback(&huart1);

   HAL_Delay(1);

```

I put ```HAL_Delay(1); ``` in order to receive data correctly but it does not make sense.

And the data shown by graph:

```

   if(i<123){

dynamicGraph1.addDataPoint(RxBuf[1]+25);

}else

i=0;

```

Note : in image, the first graph is displaying by UART and as you see suddenly a drop appears... and I don't know how to solve it, and the second graph (from above) is the correct signal.

How can I solve it?

Thanks again.

6 REPLIES 6
nsabo.1
Associate II

@Community member​ 

I got those dropped straight lines . I don't know what the problem is

Karl Yamashita
Lead III

You need to copy and paste your code exactly how you've written it as i have asked in the other post. I'm not sure why you've started a new post? You've pasted the same question.

Then there is this problem below

HAL_UART_Receive_IT(&huart1,(uint8_t*)RxBuf,20);
 
HAL_UART_RxCpltCallback(&huart1); // This is wrong, you don't make this call, the HAL driver does.
 
   HAL_Delay(1);

And where is this code at? It has to be in some function.

  if(i<123){
 
dynamicGraph1.addDataPoint(RxBuf[1]+25);
 
}else
 
i=0;

what code do you have in HAL_UART_RxCpltCallback?

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{ 
	// show your code 
}

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

@Community member​ 

Hi, Karl. sorry for my bad English.

  1. void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
  2. {
  3. // show your code
  4. }

Karl where should I use this function?

you mean I put the add data point in UartCALLBACK?

I just call this function... I can't use void in a class ...

Karl Yamashita
Lead III

Maybe my YouTube video will help you understand how to receive UART data

https://youtu.be/bCppZf8FKYg

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Thanks