cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX Color Issue with QSPI Flash

wlynn777
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions

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!

View solution in original post

5 REPLIES 5
JTP1
Lead

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

>>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..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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..

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!