How to increase Azure RTOS GUIX performance

S.A.M 56 Reputation points
2021-07-06T11:51:16.773+00:00

Hello,

I designed my demo with Azure RTOS GUIX, And running it on a STM32H750-Disco board;
The problem is, I'm getting around 15-18 fps from GUIX which is not ideal, how can I improve this?

Some extra information that would help:

  • I have 4 circular gauges in my demo,
  • Code is executing from External flash(QSPI) + pixel maps are in that section as well,
  • I tried moving gauge's pixel map to SDRAM/Internal Flash so far, but didn't effect the performance that much,

Would be appreciated if you help, I'll try to answer ASAP if anybody had a question.
Thanks in advance,
Best regards.

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
341 questions
{count} votes

Accepted answer
  1. Ken Maxwell 706 Reputation points Microsoft Employee
    2021-09-14T14:36:42.19+00:00

    Hello @S.A.M ,

    Regarding the flickering, that sounds a lot like a memory bandwidth issue. it sounds like the DMA2D isn't getting enough bandwidth to perform the background rendering operation. I'm wondering if something is fundamentally wrong, like the main CPU clock is not configured correctly, or the memory cache is not enabled?

    My colleague put some time into further optimizing this for you. I have copied her reply below:

    ----------

    I modified gx_circular_gauge_background_draw to make it work for multiple circular gauge case, see attachment.
    Changes:
    Call _gx_icon_background_draw after call gx_display_driver_callback_assign to set wait function, so that needle rotation can be process while the hardware is drawing circular gauge background.

    I also created a demo with 4 circular gauges for STM32H753I-EVAL board, see attachment.

    1. Use LCD refresh interrupt as timer source to increase frame rate of the animation.
    2. Replace gx_circular_gauge_background_draw with the modified version.

    Performance:

    1. gx_display_driver_callback_assign is NOT set, frame rate is around 49.4 frames/second
    2. gx_display_driver_callback_assign is set, frame rate is around 55.6 frames/second.

    ----------

    She found that the order of setting the display driver callback and drawing the background image was wrong (a bug), and fixed it in the attached gx_circular_gauge_background_draw.c. However as you can see, the difference between running the needle rotation code in parallel with background drawing is not dramatic, 49 fps to 55 fps. Either case is much better than the performance you are reporting, which again makes me wonder if something very fundamental is incorrect in your CPU/memory configuration. I copied links below for the modified source file and the example project which she created for STM32H753I eval board. This change will be in our next GUIX update release.

    Modified GUIX lib source file: https://expresslogic.sharefile.com/d-s3b26ec2edbc64b4787859810230b3a85
    Circular gauge test project: https://expresslogic.sharefile.com/d-sa9bdeffed18a47faa8a0c09aac531191

    Best Regards,

    Ken

    2 people found this answer helpful.
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. S.A.M 56 Reputation points
    2021-09-16T07:24:04.953+00:00

    Hi Ken @Ken Maxwell

    After you had mentioned about the potential fundamental issue in my project, I was just curious to find out if there are anything like that or not;
    So I tried to compare my Clock Config, MPU setting, and other configurations with the configuration codes in the project you sent to me.

    The final result was incredible, As you know, In the MPU configuration, each region has a struct with this type: MPU_Region_InitTypeDef, which includes few parameters and variables, In my MPU setting there was three regions for SRAM, SDRAM and External Flash (QSPI), when I was searching for the issues in my configurations, one of the Suspicious cases was about the External Flash region, in this setting:

      MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;  
    

    I realized it wasn't compatible with the MPU config in the STM32H743 project you sent;
    After I modified this line to:

    MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;  
    

    The FPS suddenly jumped from around 8-10, to 29-34 !
    Which looks absolutely strange to me!

    Even further, after I have done the additional steps to optimize the GUI that your colleague suggested, It became better and now I have around 34-42 FPS!

    Now I just want to say many thanks for your patience and considering my problem, I greatly appreciate your assistance in my project, and thanks to your colleague for her time spent on my issue.

    After all, 34-42 FPS look pretty reasonable to me, in compare to what She reported for the FPS (55.6 fps at the end).
    I think these two reasons might cause this difference:

    1. I'm using STM32H750B-Disco board, which has a low amount of Internal flash in comparing to STM32H743i-Eval, and I have to put all of the read-only data(including all of the pixelmaps and codes) in the external flash (QSPI), and it makes sense if I get lower FPS because of that, am I right?
    2. And another one, In her example project, there are 4 gauges which each one has a needle pixelmap image with 2140 pixels;
      But in my own demo, I have 4 gauges as well, but two of them using a 401-pixels image and two of them using a 9947-pixels image, means in total
      my needle images are bigger more than two times in comparing to the needle images in her project;
      And this should effect the performance a lot I think.

    I would like to see if you agree with me about the above cases;

    Again, I do appreciate all of your helps; I just have another quick question which I'll ask in another message!

    Best Regards,
    Sam.

    0 comments No comments

  2. S.A.M 56 Reputation points
    2021-09-16T07:58:28.147+00:00

    I think it doesn't worth to open another topic for this little question, So I'm going to ask it here!

    As long as I realized, the accuracy of the angle in the Circular Gauges is only 1 degree,

    And because the Radius of Rotation in my circular gauges are pretty high (more than 300 pixels), I do need more accuracy because I need smoother rotation animations;

    Are there anyway to use more accurate values for the angle? For example 0.1 degree. @Ken Maxwell

    Regards,
    Sam.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.