TouchGFX Color Issue with QSPI Flash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 07:23 AM
I am currently working on a TouchGFX project with an H7 custom board with QSPI external flash and SDRAM.
I am able to get the display working properly when not using the external flash.
The external flash has been tested separately by writing to it & using the testbinary1M.bin file and the results are as expected.
Images can be stored at the external flash address, and pixel data seems to be stored correctly too (Below is pixel data for a red PNG image...)
// 4.22.0 0xd2f03614 D2 R1 FRGB888 U888 N0 SExtFlashSection
// Generated by imageconverter. Please, do not edit!
#include <touchgfx/hal/Config.hpp>
LOCATION_PRAGMA("ExtFlashSection")
KEEP extern const unsigned char image_redpng[] LOCATION_ATTRIBUTE("ExtFlashSection") = { // 480x800 RGB888 pixels.
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
But when using the external flash, the colors in the display changes (red becomes green, green becomes blue, blue becomes red, etc. See attached)..
Opaque image format is RGB888, non-opaque ARGB8888.
Here's my init in main:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_FDCAN1_Init();
MX_FDCAN2_Init();
MX_FMC_Init();
MX_I2C3_Init();
MX_LTDC_Init();
MX_QUADSPI_Init();
CSP_QUADSPI_Init();
CSP_QSPI_EnableMemoryMappedMode();
MX_RTC_Init();
MX_SPI3_Init();
MX_UART4_Init();
MX_USB_OTG_HS_PCD_Init();
MX_CRC_Init();
MX_TIM3_Init();
MX_DMA2D_Init();
MX_ADC1_Init();
MX_TouchGFX_Init();
/* Call PreOsInit function */
MX_TouchGFX_PreOSInit();
Additions for the FLASH.ld file:
QUADSPI (r) : ORIGIN = 0x90000000, LENGTH = 64M
ExtFlashSection :
{
*(ExtFlashSection ExtFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >QUADSPI
Does anyone know how to fix this? Please help.. Thanks
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-10 05:45 AM
Hi, thanks for your answer, that "byte shift" was the keyword.
I saw this thread: https://community.st.com/t5/stm32-mcus-products/external-flash-downloader-shift-1-byte-in-flash-area/td-p/55286 and it solved the problem.
Turns out DUMMY_CLOCK_CYCLES_READ_QUAD should be 8.
Now my colors are showing correctly.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 08:14 AM
Hello
Have you check this thread
Seems pretty much same type of problem.
Br JTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 08:30 AM
Tell us a bit about your QSPI implementation and how it was validated.
Perhaps nibble or byte shift due to incorrect 3/4-byte addressing, or dummy cycles, ie inconsistent understand between device settings and STM32 side ones.
Would suggest using CRC or HASH to ensure the integrity of the memory side data vs what you constructed on the PC
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 08:34 AM
>>The external flash has been tested separately by writing to it & using the testbinary1M.bin file and the results are as expected.
The External Loader might be internally consistent, but different to the BSP implementation used by the application.
Step#1 validate image content with CRC or SHA256 which is going to be sensitive to bit and byte level discrepancies in the data.
If the data is valid, and correctly aligned, check bitmap encoding methods are applied consistently in generation vs usage..
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 08:41 AM
Hi, thanks for the reply.
I did see that thread, and I can confirm the pixel format settings in the CubeMX and TouchGFX are the same. I have also made the same adjustments to the Framework Features to match that..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-10 05:45 AM
Hi, thanks for your answer, that "byte shift" was the keyword.
I saw this thread: https://community.st.com/t5/stm32-mcus-products/external-flash-downloader-shift-1-byte-in-flash-area/td-p/55286 and it solved the problem.
Turns out DUMMY_CLOCK_CYCLES_READ_QUAD should be 8.
Now my colors are showing correctly.
Thank you!