1.2k views
in GUI Development by

The contents of my display should look like this:

Normally this does work as expected. But after some time, the display looks very strange:

Sometimes after some touch operations the display recovers to normal operation, sometimes I have to boot the device.

1 Answer

0 votes
by
Hello,

mysterious ... if the error case occurs, do you get some error messages on the console?

Best regards

Paul Banach
by
Not really at this time, when the error occurs.

I know, that there is a problem with some display element, which I didn't car for so far:

[ERROR in ewgfx.c:984] Failed to create surface with format: 0 and size ( 802 x 482 ).
by

Hello,

the error: [ERROR in ewgfx.c:984] Failed to create surface with format: 0 and size ( 802 x 482 ) is reported, if the operation to load of a bitmap resource was not able to allocate memory for the bitmap pixel (here 802x482 pixel).

It seems to be an 'out of memory' error. Possibly, the affected bitmap is the green/yellow bitmap filling the entire background area. What can you do?

Step 1: verify how much memory your application is using in the target system. For this purpose add the invocation of the function EwPrintProfilerStatistic() to your main loop just at the begin of the loop. This will cause the application to output on the console memory usage statistic. Analyze the information. Does it increase?

Step 2: If the root of the problem is the complexity of your application, you can simplify the background image. Instead of using the large bitmap with RGBA colors you can:

- Put a filled rectangle in the background configured with solid green/yellow color as I saw in your screenshot above.

- To show the light effects, use an ALPHA8 bitmap. This bitmpa occupies only 1-byte per pixel instead of 4-bytes as it is actual the case in your application. To configure a bitmap resource as containing alpha-only information, you specify the image file in the resource's attribute AlphaName. Please note, ALPHA8 bitmaps don't have their own color information. Instead, you can determine the desired color dynamically in the image view intended to dsiplay the affected bitmap.

Best regards

Paul Banach

by

Hello Paul,

with 16MB of RAM available, the amount of memory should be no problem:

   81236 bytes occupied by 129 Chora objects
   24768 bytes occupied by 371 strings
 7815902 bytes occupied by Graphics Engine objects (without framebuffer)
    7890 bytes occupied by 'watermark' images (used only in evaluation version)
TOTAL : 7929796 bytes, PEAK : 7929796 bytes

Is the frame buffer included in "TOTAL"?

by

Hello Paul,

"[ERROR in ewgfx.c:984] Failed to create surface with format: 0 and size ( 802 x 482 )"

occurs, if I call this function for a Horizontal list:

HorizontalListMenu.InvalidateItems( 0, this.HorizontalListMenu.NoOfItems - 1 );

It is called within the UpdateViewState functon of the view containing the horizontal list.

by

Hello,

the reported memory usage is without framebuffer as explicitly mentioned in the printed log text. Since I don't know your system configuration and color format, let's assume following:

Framebuffer double 800x480 pixel RGBA8888: 3.072.000 Bytes

Memory usage reported by application: 7.929.796 Bytes

Memory for the (failed) background bitmap 802*482 pixel RGBA8888: 1.546.256 Bytes

Total: 12.548.052 Bytes

According to this assumtion, the 16 MB should be sufficient. However, I don't know how much memory is occupied by other application parts, your middleware, operating system, etc. 

Please try following:

1. In your aplication remove the image view displaying the large background image. Use instead a filled rectange view.

2. Test the application. Does the problem still occur?

3. If the problem is not present anymore, then it is related to the memory limitation. In this case, please follow the indication to use ALPHA8 bitmap as explained in my first comment. This saves more than 1 MB RAM.

4. If the problem still persists, we have to investigate other causes.

Best regards

Paul Banach

by

Hello Paul,

removing the background images reduses the amount of used memory:

   79228 bytes occupied by 123 Chora objects
   25506 bytes occupied by 362 strings
 6253402 bytes occupied by Graphics Engine objects (without framebuffer)
    7890 bytes occupied by 'watermark' images (used only in evaluation version)
TOTAL : 6366026 bytes, PEAK : 6366026 bytes

However, the problem still persists.

Whats's also strange to me: My Display resolution is 800x480. The error message mentions a size of 802x482.

by
Hi!

Just another idea: Have you checked your MPU-Settings and cache-settings?

Br,
Manuel
by
Hello,

802x402 is the correct size. Internally all bitmaps have 1 pixel transparent border, which is necessary for the case of 2D/3D warp transformation being applied on the bitmap.

Could you post another screenshot showing the error case and with the background image being disabled?

What HW are you using?

Best regards

Paul Banach
by

I have swichted off MPU and caches: No difference.

Hardware:
STM32F746NG with 16MB SDRAM and 128MB Flash

When I set the property "Embedded" of the background image to true, the error messages disappears. However, the image is not displayed:

by
I really do not understand this: When background image is green the error occurs, when background image is red it doesn't.
by
Ok. The white color we see is the color of the rectangle you use instead of the background image, right?

The background of the clock in the screenshot, it seems to be not updated correctly, right? I see some remains in its background.

If this is true, it seems as if the background were not always redrawn.

In order to not overlook anything, the problem with the screen update and the error message occur simultanously, right?

Or, they don't depend on each other?

Logically, after you have replaced the image by the rectangle, the error message should disappear.

The different behaviour between red and green colors is actually inexplicable.

Best regards

Paul Banach
by

Hi!

Please keep in mind, that setting the proper MPU settings is crucial: As ST writes in the AN4861, chapter 4.6.2, you need to set-up your MPU settings in order to avoid speculative read access by the Cortex-M7 core - which could lead to exceptions. Can you please configure your MPU settings according to your memory layout?

Br,
Manuel

by
Hi Manuel,

since we use the same CPU and the same amount of RAM as on the DISCO board, the settings should be ok, I assume.
by
Hi Paul,

in the picture I didn't exchange the real background by the rectangle, because the problem did also exist without the background image.

Clock and some elements in the header are not updated correctly, but elements in the footer are displayed correctly. The fragments on the clock are the remains of the hour handle.

No, they don't depend. The both problems do not occur at the same time. The error message is displayed any time I open or close a dialog in the bottom part. The background is changed independently from this, because it ist triggered by some external event, which is coming from serial port.
by

This is my status quo:

  • in the profile I switched StringConstants to DirectAccess
  • this is not possible for BitmapResources, becaus the hex file would rise to 45MB
  • switching ConcurrentOperation in ew_bsp_graphics.c seems to have no impact
  • modifying MPU configuration improved the whole system: The scrambled screen didn't show up til now, the ewgfx.c:984 error shows up sometimes.
Can I send my MPU configuration for a checkup, if your ST specialists are back from holidays?
by
Hello,

it sounds good! Regarding your questions:

- Is 45 MB a problem? I thought your system has 128 MB flash.

- Review of MPU settings is of course possible. As soon as our specialist is back, he can analyze it.

- Regarding the error message: as mentioned above it is related to RAM size limitation. Your options are:

Option 1: activate DirectAccess for Bitmaps.

Option 2: The value 45 MB indicates, that your project contains a lot of large images. Are really all images necessary? Maybe, you can replace some images by filled rectangles?

Option 3: as explained at the begining of the thread you can also change bitmaps which are not necesarily RGBA to ALPAH8 which reduces the memory size.

Option 4: Verify the initialization of the memory manager. How much RAM is assigned to the manager? If possible assign more RAM.

Best regards

Paul Banach
by
Last week you suggested, that one of your ST specialists would review my MPU settings. To whom should I send my data?
by
Hello,

send it to support@embedded-wizard.de and please refer to this thread.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...