2025-01-13 10:06 PM - last edited on 2025-01-14 01:14 AM by Andrew Neil
Hello Everyone,
Earlier we have successfully developed a variant using STM32F746 Discovery board but now we have shifted towards our own developed PCB with custom LCD Display 800 * 480.
Our new PCB uses MT25Q128A external flash for storing images, text and font used by TouchGFX and we are using single buffer allocation in external SDRAM for framebuffer. We are using different pins for QuadSPI communication so had to develop custom external loader for this. We have tested the external loader for various images and it works fine.
When we started inputting texts in TouchGFX the system would wait infinitely in xQueueSemaphoreTake() function so we suspected something might be wrong with loading from external flash so we created another project this time stored everything in internal flash, again the result was same, the TouchGFX hangs while using texts.
After searching through the community we came across following links:
Here it is suggested to try to change the line in stm32h7xx_hal_dma2d.c, in the function, but is related to H7 series.
Same thread also suggested changing MPU Config
We had disabled MPU in our project but even after enabling it the result was unaffected.
Please guide me where I am doing wrong.
Thankyou
Regards,
Pitbull
2025-01-26 11:50 PM
The reason it can show a string of spaces, is because there are no pixels in a space.
This points to a problem with reading flash.
But then, if it also fails with texts and flash in internal flash, then something else is wrong.
When it hangs there, someone did not return the framebuffer semaphore.
Any custom widgets? Other code calling lockframebuffer?
Did you remember to call the superclass in TouchGFXHAL::endFrame? (if you modified it).
Another thing to try:
in STM32DMA.cpp, try different settings here:
BlitOperations STM32DMA::getBlitCaps()
{
return static_cast<BlitOperations>(BLIT_OP_FILL
| BLIT_OP_FILL_WITH_ALPHA
| BLIT_OP_COPY
| BLIT_OP_COPY_L8
| BLIT_OP_COPY_WITH_ALPHA
| BLIT_OP_COPY_ARGB8888
| BLIT_OP_COPY_ARGB8888_WITH_ALPHA
| BLIT_OP_COPY_A4
| BLIT_OP_COPY_A8);
}
If you remove the A4 line, all texts are drawn in SW, not DMA2D. Does it make a difference?
In the same file, using a debugger, set a breakpoint on this yellow line:
What does the ISR register of DMA2D say? Any errors?
Also check that the FGMAR (font) and BGMAR (framebuffer) addresses are both readable.
Verify the addresses in the MAP file.
Best hopes!
2025-01-27 08:11 PM
Hii @Flemming Gram CHRISTENSEN
Thankyou for your support.
I tried the following as you suggested.
If you remove the A4 line, all texts are drawn in SW, not DMA2D. Does it make a difference?
No. It does not make any difference and the screen hangs as in this as well even if I move everything to internal flash.
In the same file, using a debugger, set a breakpoint on this yellow line:
The breakpoint is never hit in the debugger.
The system enters the function but does not enter the mentioned case. It either enters in default case ( BLIT_OP_COPY & BLIT_OP_COPY_16BIT ) or BLIT_OP_COPY_ARGB8888_WITH_ALPHA case.
Thankyou
Regards,
Pitbull
2025-01-27 10:05 PM
Show code crash, is generated or your custom?
2025-01-28 02:17 AM
Hii @pitbull when i started working on custom board i also faced issue whenerver getFont() function was getting called, MCU was going going to memfaulthandeler(). I tried diffrent diffrent MPU configuration but didnt work anything. latter i got to know that QUADSPI BSP configuration was wrong. by adding correct BSP firmware my issue got resolved.
I'll suggest you to dont use TouchGFX genrated BSPs.
2025-01-28 08:46 PM
Hii
Show code crash, is generated or your custom?
@MM..1 Please find my attached project for your reference. I have attached the CustomLoader project for programming the external flash as well as the final project in which the text is to be displayed.
Hii @JJhin.1
I am currently using n25q128a driver from stm32. But as you are suggesting reading from external flash is an issue but when I store the text in internal flash I continue to face the same issue.
I will try to rewrite the qspi driver as you suggested and will update you accordingly.
I am using MT25Q128A as external flash using qspi and have developed a custom loader using different pinout for qspi for loading the external flash, but am using the N25Q128A driver from stm32 in the main project.
The images are displayed without any issue but as soon as text is to be rendered the touchGFX hangs.
Thankyou for your guidance.
Regards,
Pitbull
2025-01-29 07:53 AM
Sending this big zips isnt very helpfull. And your project is unsynced code and gui differ...
Normal show this line i comment code work. Uncomment crash.
Now you send
void imageScreenView::changeText()
{
mode++;
switch(mode)
{
case 0:
//Unicode::strncpy(helloTextBuffer, "Cosmo", HELLOTEXT_SIZE);
break;
case 1:
//Unicode::strncpy(helloTextBuffer, "New PCB", HELLOTEXT_SIZE);
break;
case 2:
//Unicode::strncpy(helloTextBuffer, "Gauging", HELLOTEXT_SIZE);
break;
case 3:
//Unicode::strncpy(helloTextBuffer, "Air Leak Tester", HELLOTEXT_SIZE);
break;
case 4:
//Unicode::strncpy(helloTextBuffer, "TWAIPL", HELLOTEXT_SIZE);
break;
default:
mode = 0;
//Unicode::strncpy(helloTextBuffer, "Technowings", HELLOTEXT_SIZE);
break;
}
//helloText.invalidate();
}
2025-01-29 08:19 PM
Hello @MM..1
#include <gui/frontscreen_screen/frontScreenView.hpp>
frontScreenView::frontScreenView()
{
}
void frontScreenView::setupScreen()
{
frontScreenViewBase::setupScreen();
testText.setVisible(true);
testText.invalidate();
}
void frontScreenView::tearDownScreen()
{
frontScreenViewBase::tearDownScreen();
}
Later if I comment the set Visible line of code then the code runs without any issue.
But I am unable to view the text.
#include <gui/frontscreen_screen/frontScreenView.hpp>
frontScreenView::frontScreenView()
{
}
void frontScreenView::setupScreen()
{
frontScreenViewBase::setupScreen();
//testText.setVisible(true);
//testText.invalidate();
}
void frontScreenView::tearDownScreen()
{
frontScreenViewBase::tearDownScreen();
}
Thankyou
Regards,
Pitbull
2025-01-29 09:14 PM
Check in TouchGFX may be you hide that text.
also check frontscreenViewBase.cpp file. in that your text should get initialized as follow:
Screen1ViewBase::Screen1ViewBase()
{
textArea1.setXY(411, 180);
textArea1.setColor(touchgfx::Color::getColorFromRGB(255, 0, 0));
textArea1.setLinespacing(0);
textArea1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_JTFE));
add(textArea1);
}
2025-01-29 09:49 PM
On your send project no testText exist realy must crash ! You name it trialText then use real names.
2025-01-29 09:51 PM - edited 2025-01-29 09:54 PM
Hii @JJhin.1
Yes I have hidden the text in touchGFX Designer but controlling its visibility through code.
But setting it visible through code causes touchGFX to hang.
Following is the generated source file code at initialization
frontScreenViewBase::frontScreenViewBase() :
buttonCallback(this, &frontScreenViewBase::buttonCallbackHandler)
{
__background.setPosition(0, 0, 800, 480);
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
add(__background);
backgroundImage.setXY(160, 95);
backgroundImage.setBitmap(touchgfx::Bitmap(BITMAP_BACKGROUND_ID));
add(backgroundImage);
switchScreenButton.setXY(331, 222);
switchScreenButton.setBitmaps(touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_36_SMALL_ROUND_ACTION_ID), touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_36_SMALL_ROUND_PRESSED_ID));
switchScreenButton.setAction(buttonCallback);
add(switchScreenButton);
testText.setXY(354, 186);
testText.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
testText.setLinespacing(0);
testText.setTypedText(touchgfx::TypedText(T___SINGLEUSE_VTF6));
testText.setVisible(false);
add(testText);
}
Also I have checked the memory where the text is stored and verified it to be correct.
In map file following are the addresses where the generated text are stored in external flash
TextFlashSection
0x9009b168 0x34
*(TextFlashSection TextFlashSection.*)
TextFlashSection
0x9009b168 0x8 ./TouchGFX/generated/texts/src/LanguageGb.o
0x9009b168 indicesGb
TextFlashSection
0x9009b170 0x22 ./TouchGFX/generated/texts/src/Texts.o
0x9009b170 texts_all_languages
*fill* 0x9009b192 0x2
TextFlashSection
0x9009b194 0x8 ./TouchGFX/generated/texts/src/TypedTextDatabase.o
0x9009b194 typedText_database_DEFAULT
0x9009b198 typedTextDatabaseArray
*(.gnu.linkonce.r.*)
0x9009b19c . = ALIGN (0x4)
TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
0x4e, 0x65, 0x77, 0x20, 0x54, 0x65, 0x78, 0x74, 0x0, // @0 "New Text"
0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x0 // @9 "Testing"
};
From the memory reader we are able to read the exact text stored at the address mentioned in the map file.
Please correct me if anything is wrong here.
Also if I change the text configuration to following:-
That is enable binary font file and disable remap texts then the Text is not displayed even when set to Visible but the task continues without getting stuck.
Thankyou
Regards,
Pitbull