cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE compile error ADC input LCD display

Kss.1
Associate II

https://www.youtube.com/watch?v=EbWOv_0Lp-U&t=1873s

I watched YouTube and followed it. This is to display the voltage coming into ADC IN0 on the LCD.

I used the TouchGFX + CubeIDE compiler, but an error occurred.

On YouTube, it compiles normally. Please let me know why the error occurred.

make -j12 all 

arm-none-eabi-g++ "../TouchGFX/gui/src/screen1_screen/Screen1View.cpp" -mcpu=cortex-m7 -std=gnu++14 -g3 -DUSE_HAL_DRIVER -DSTM32F746xx -DDEBUG -c -I../TouchGFX/gui/include -I../TouchGFX/generated/fonts/include -I"C:/ST/STM32CubeIDE_1.3.0/SWTEST/Drivers/Components" -I"C:/ST/STM32CubeIDE_1.3.0/SWTEST/Drivers/Components/n25q128a" -I../TouchGFX/generated/texts/include -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../TouchGFX/generated/images/include -I"C:/TouchGFXProjects/SWITCHTEST/Drivers/Components/Common" -I"C:/ST/STM32CubeIDE_1.3.0/SWTEST/Drivers/Components/ft5336" -I"C:/TouchGFXProjects/SWITCHTEST/Drivers/Components/n25q128a" -I../Core/Inc -I../TouchGFX/generated/gui_generated/include -I"C:/ST/STM32CubeIDE_1.3.0/SWTEST/Drivers/Components/Common" -I"C:/TouchGFXProjects/SWITCHTEST/Drivers/Components/ft5336" -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../Middlewares/ST/touchgfx/framework/include -I"C:/ST/STM32CubeIDE_1.3.0/SWTEST/Drivers/BSP" -I../TouchGFX/target/generated -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -I../TouchGFX/App -I../TouchGFX/target -O0 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -fstack-usage -MMD -MP -MF"TouchGFX/gui/src/screen1_screen/Screen1View.d" -MT"TouchGFX/gui/src/screen1_screen/Screen1View.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "TouchGFX/gui/src/screen1_screen/Screen1View.o"

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp: In member function 'virtual void Screen1View::analogUpdate(uint32_t)':

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:10: error: 'textAreaADBuffer' was not declared in this scope

 memset(&textAreaADBuffer, 0, TEXTAREAAD_SIZE);

     ^~~~~~~~~~~~~~~~

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:10: note: suggested alternative: 'textArea1'

 memset(&textAreaADBuffer, 0, TEXTAREAAD_SIZE);

     ^~~~~~~~~~~~~~~~

     textArea1

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:31: error: 'TEXTAREAAD_SIZE' was not declared in this scope

 memset(&textAreaADBuffer, 0, TEXTAREAAD_SIZE);

                ^~~~~~~~~~~~~~~

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:31: note: suggested alternative: 'TEXTAREA_HPP'

 memset(&textAreaADBuffer, 0, TEXTAREAAD_SIZE);

                ^~~~~~~~~~~~~~~

                TEXTAREA_HPP

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:21:2: error: 'textAreaAD' was not declared in this scope

 textAreaAD.invalidate();

 ^~~~~~~~~~

../TouchGFX/gui/src/screen1_screen/Screen1View.cpp:21:2: note: suggested alternative: 'textArea1'

 textAreaAD.invalidate();

 ^~~~~~~~~~

 textArea1

make: *** [TouchGFX/gui/src/screen1_screen/subdir.mk:23: TouchGFX/gui/src/screen1_screen/Screen1View.o] Error 1

"make -j12 all" terminated with exit code 2. Build might be incomplete.

I saw your YouTube and tried it. However, some errors have occurred.

Some variables are not declared, how can I solve them?

void Screen1View::analogUpdate(uint32_t value)

{

memset(&textAreaADBuffer, 0, TEXTAREAAD_SIZE);

Unicode::snprintfFloat(textAreaADBuffer, sizeof(textAreaADBuffer), "%.3f", value * 0.000805664 ); // 3.3/4096 = 0.000805664

textAreaAD.invalidate();

}

I tried to display the analog input voltage on the LCD screen, but an error occurred in the screen viewer function. The problem made me sick for a week. I want to upload a proper YouTube. The person who uploaded YouTube wants to upload in detail how the error did not occur.

Can someone please help me.

It seems crazy.

1 ACCEPTED SOLUTION

Accepted Solutions

In ADC conversion complete callback, set a flag. Use this flag to poll for end of conversion. ​then reinitialize ADC conversion.

View solution in original post

12 REPLIES 12
prain
Senior III

your problem is related to scopes in c++ . search for textAreaADBuffer and ​TEXTAREAAD_SIZE. make sure these are defined or included in file Screen1View.cpp

Kss.1
Associate II

screen1View.hpp

I resolved it by declaring as below.

#ifndef SCREEN1VIEW_HPP

#define SCREEN1VIEW_HPP

#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>

#include <gui/screen1_screen/Screen1Presenter.hpp>

class Screen1View : public Screen1ViewBase

{

public:

  Screen1View();

  virtual ~Screen1View() {}

  virtual void setupScreen();

  virtual void tearDownScreen();

  virtual void analogUpdate(uint32_t value);

protected:

  static const uint16_t TEXTVIEW_BUFF_SIZE = 50;

         Unicode::UnicodeChar textViewBuffer[TEXTVIEW_BUFF_SIZE];

};

#endif // SCREEN1VIEW_HPP

prain
Senior III

Sounds like you are missing a directory from your include path.

Compilation was successful. I downloaded it to the 746 board, but the LCD screen is broken. I chose LTDC as the RGB565 format 16bit, but I can't tell.

Why is the screen broken?

There are LCD examples for your board​. Did you try them?

Dear prain

After a great deal of effort, it compiled normally.

However, the adc value is not displayed on the screen. There is no reaction even when the voltage is input by the potential meter.

main.c

void StartTaskanaloginput(void const * argument)

{

/* USER CODE BEGIN StartTaskanaloginput */

PollingInit();

/* Infinite loop */

for(;;)

{

PollingRoutine();

osDelay(1);

}

/* USER CODE END StartTaskanaloginput */

}

PollingRoutine(); I need to perform a function, but in PollingRoutine.c

void PollingRoutine()

{

}

There is no function.

So, ask if the adc value is not displayed on the LCD screen.

I can't figure out what the problem is, but let me know.

Did you implement your own ADC read routine or using HAL_​ADC_x functions?

Dear prain

yes i used HAL _ADC function below

void PollingInit()

{

HAL_ADC_Start_DMA(&hadc1, &uhADCxConvertedValue,10);

HAL_TIM_Base_Start_IT(&htim1);

}

Execute pollingInit() function in main.c.

In ADC conversion complete callback, set a flag. Use this flag to poll for end of conversion. ​then reinitialize ADC conversion.