STemWin stm32F429 Disco Lcd rotation of 90 degrees

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • STemWin stm32F429 Disco Lcd rotation of 90 degrees

    I'm using stm32F429 Disco and StemWin+ LTDC (Lcd ILI9341)
    Lcd Driver -> GUI_DEVICE_CreateAndLink(GUIDRV_LIN_32, GUICC_M8888I, 0, 0);

    when changing rotation of 180 degrees all works Ok
    Lcd Driver ->GUI_DEVICE_CreateAndLink( GUIDRV_LIN_OXY_32, GUICC_M8888I, 0, 0);

    I need to change the rotation of the LCD by 90 degrees
    I try to use this driver
    GUI_DEVICE_CreateAndLink(GUIDRV_LIN_OSX_32, GUICC_M8888I, 0, 0);
    but it does not work.
    Does anyone know how to change the rotation by 90 degrees

  • Hello Smashing,

    Please note that the function GUI_SetOrientation() and GUI_SetOrientationEx() both return 1, in case the (first) parameter Orientation == 0 or if there is not enough memory available.

    Please check your parameter or increase the amount of memory which is allocated to emWin.

    Best regards,
  • Hello,

    Please note that GUI_SetOrientation() is intended to be used if there is no other opportunity to set up orientation. Usually emWin display drivers offer changing the orientation in an optimized way. Detailed information can be found in the chapter "Display drivers" in the emWin user manual.

    Best regards,
  • Using GUI_SetOrientation


    I'm completely new to emWin. I need to create screens with a bitmap as a background to operate in landscape or portrait modes. There are different versions of the bitmap for the 2 orienations. The display devive is 480x272.

    For landscape operation I can create a window 480x272, place an IMAGE that is defined as 0,0 to 480,272 on it and load a BMP file into it. I can then draw buttons on it - it is all fine.

    For portrait mode I call GUI_SetOrientation() with GUI_SWAP_XY set.I now create a window 272x480, place an IMAGE that is defined as 0,0 to 272,480 on it and load a different BMP file into it and draw some buttons. The buttons are drawn using the correct interpretation of top, width, etc for the rotation, and the text on the button is drawn in the correct direction. However, the window height is limied to 272 pixels instead of 480. Anything defined as being below this on the Y axis is not drawn.

    What else to I have to change to increase the available height from 272 to 480 pixels (and ?I assume reduce the width to from 480 to 272)

  • I'm experiencing same problem as in smashings original question. I'm using STM32F429 discovery hardware and STemWin's Hello world example application from STM32Cube_FW_F4_V1.1.0 package as a base for my tests.

    I have put some texts, bitmaps and rectangles to the screen as a test. Everything works correctly when I use GUIDRV_LIN_32 driver as is in the example.

    Rotating screen 180 degrees with use of GUIDRV_LIN_OXY_32 seems ok. But when I take a closer look it's not. Texts and bitmaps are correctly on the screen. Every shape painted with GUI functions is on opposite coordinate even texts and bitmaps are on correct position. So for example GUI_FillRect(10,10,20,20) will be on opposite corner of the screen than bitmap painted with GUI_BMP_Draw((void *)&bmptest, 10, 10). Every painted shape is looking correct but visible on the wrong place.

    Real case is that I need a rotation of 90 or 270 degrees and this is a bigger mess. Texts and bitmaps are still ok but every shape and fill with GUI functions will cause broken graphics when I use GUIDRV_LIN_OS_32, GUIDRV_LIN_OSY_32 or GUIDRV_LIN_OSX_32 driver. It's quite like in smashings photo. Here is mine with some texts and one circle. As you can see all texts are ok and the circle is in three parts. Using OSX or OSY driver will also cause already mentioned coordinate problems. I have also noticed that defining LCD_MIRROR_X or LCD_MIRROR_Y will not change anything. I have also noticed that changing XSIZE_PHYS and YSIZE_PHYS will effect somehow. Using same size for both directions will fix the graphics. For example 240x240 and 220x220 are ok but 240x220 and 220x240 are corrupted.

    Finally... Should it be possible to create landscape screen by only changing the driver from GUIDRV_LIN_32 to GUIDRV_LIN_OSY_32? What could possible explain that texts and bitmaps are all fine but painting shapes or filling/clearing the screen will corrupt the display? What could cause opposite coordinates problem? There shouldn't be a need to change anything in the ili9341 initialization?

    Any ideas are welcome. Thank you.
  • Is it possible that STemWin (should be same as emWin) can cause problem where texts are displayed correctly at the same time as circles are displayed wrongly?

    That don't look like a display driver issue because some stuff is displayed totally ok. As far as I understand the display image is first created to the frame buffer and then transferred to the screen. Transferring data from frame buffer could not anymore separate if content is text or circle - even on same position.

    What can possible cause that writing to frame buffer can be faulty as shown in my picture? Some problem in size definitions?
  • Hello,

    I am sorry. This took a while.

    I did a test using the STM32F429 discovery hardware. I selected the GUICC_M8888I color conversion and check the function of GUIDRV_LIN_OSX_32, GUIDRV_LIN_OSY_32 and GUIDRV_LIN_OS_32. Each of them works fine. If you want to try this yourself, please check out our SEGGER evaluation package available on

    Best regards,
  • Hi Adrian,

    I've tested STemWin Examples [1] on STM32F429 Discovery with GCC Compiler (EmBlocks 2.30 [2]).

    Original configuration is as follow
    #define XSIZE_PHYS 240
    #define YSIZE_PHYS 320
    #if (COLOR_MODE_0 == _CM_ARGB8888)
    • Without any modification I get the following result
    • With GUIDRV_LIN_OSY_32 I get the following result
    • With #define YSIZE_PHYS 240 I get the following result
    When I set a screen size less than 240px, screen was displayed as expected, but for size is greater than 240px, screen was corrupted as shown in above image. In my case, It seems that STemWin doesn't support the rotation the size greater than 240px.

    How to rotate screen for its size greater than 240px. Thanks in advance.


    • 2014-10-30 11.37.19.jpg

      260.3 kB, 600×891, viewed 4,649 times
    • 2014-10-30 11.38.36.jpg

      277.97 kB, 600×867, viewed 4,726 times
    • 2014-10-30 11.39.44.jpg

      173.94 kB, 600×855, viewed 4,839 times
  • Hi Adrian,

    Thanks for quick reply.

    It seems that your evaluation example for STM32F429-Discovery is an IAR project. I have no IAR installation. I tried to it to import into EmBlocks IDE. However, I didn't succeeded. My currents work was developed on EmBlocks. So I'm looking for a solution for my current configuration. (STemWin 5.22/STM32F429Discovery/EmBlocks 2.30)