TouchGFX Color Issue with QSPI Flash
- May 8, 2024
- 2 replies
- 2729 views
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
