Jump to content

Support for STM32F469i-Discovery


inakto

Recommended Posts

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

Hello @inakto,

The STM32F469i-Discovery board support is on the ToDo list for the next release. The reason we haven't had time to finish it and put it into the repository yet is because the way you implemented it is unfortunately not the intended way. Furthermore, we are experiencing some performance issues.
Did you improve/change/modify the implementation that you sent us or are you working with that one?

Link to comment
Share on other sites

  • 4 weeks later...

Hello Joel, 

I am attempting to do the board files for the STM32F469 board. I took what inakto had and it was working ok (he had ugfx2.5). I just updated to the latest ugfx and I am rewriting the board implementation (this time trying to follow what you guys recommend). I have the FT6x06 files with the I2C part done, and my screen touches get registered, however, I am still struggling with the board_STM32LTDC.h file. I have attached a picture of what the calibration page looks like with my current implementation of the board file and the FT6x06 files, as it is shown in the file, the calibration page is shifted (my actual windows are also shifted if I do self calibration).

Any recommendations on what I should try?

Regards,
Maytham

15049610_10202507968976177_2113618820_n.jpg

Link to comment
Share on other sites

@Maytham I'm glad to hear that you are diving into this as we are currently really drowning in work! It's good to see that you have something up and running.
Unfortunately I don't have any idea on top of my head what might cause this issue. I'm not very familiar (not at all) with the new MIPI interface.

As @inakto mentioned it might be best if you post some of your work so we and other can have a look at it.

Link to comment
Share on other sites

Hey, 

So, I managed to get the display and touch screen working (I will assume it is not optimal and will keep thinking of a way to do it better). 

I attached my board_STM32LTDC.h and gmouse_lld_FT6x06_board.h files (I tried doing pure I2C calls for the gmouse file, but there were some issues where it just kept thinking I am touching when I am not actually doing anything. 

The board_STM32LTDC.h file I implemented does whatever inakto had with the BSP_LCD_InitEx, however, since you already had the (sync, back and front porch already implemented, I took that out and I made sure that your function _ltdc_init happens in the right order. The values for (static const ltdcConfig driverCfg) I took from the BSP_LCD settings. 

gdisp_lld_STM32LTDC.c file:
I added inside static void _ltdc_init(void): (this was causing the shift in the display)
    // Enable the LTDC clock
    #if defined(STM32F469xx)
        RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR);

gmouse_lld_FT6x06.c file:
I commented out the aquire_bus and release_bus calls (I didn't see a need for them even when using I2C):
I added breaks inside the [static bool_t read_xyz(GMouse* m, GMouseReading* pdr)] function for the GDISP_ROTATE_0 and the GDISP_ROTATE_90 case; The function was treating the GDISP_ROTATE_0 case as a GDISP_ROTATE_180 without the break and the touches were not registering correctly. 

I attempted to get PNG images displayed and I am getting a GDISP_IMAGE_ERR_NOMEMORY error, I still need to look into it to figure things out, however, I am able to display BMP images nicely without any loss in the image quality (at least for my eyes)

 

Let me know if what I did in these files is correct or if you have any comments on how I can improve it. 

Regards,

15204014_10202531996576852_333707684_o.jpg

board_STM32LTDC.h

gmouse_lld_FT6x06_board.h

gmouse_lld_FT6x06.c

gdisp_lld_STM32LTDC.c

Edited by Joel Bodenmann
Removing unnecessary quote
Link to comment
Share on other sites

Thank you for your effort on creating the corresponding drivers. I will have a look at your attached files tonight.
Ideally we would be able to use the existing STM32LTDC display driver without modifying it. If that is not possible (you mentioned something about modifying the LTDC init functions) we might consider making those functions become part of the board file instead. As this board & display controller combination is using the real LTDC which is the same for all other boards that use the LTDC there really shouldn't be two drivers at the end.

I put up @nathan.loretan to the task of creating generic drivers for that board. We'll see whether he can get it up and running in time for the upcoming release of µGFX 2.7 that is scheduled for mid December. Unfortunately neither @inmarket nor I have currently the time to spare for creating those drivers.
We appreciate your efforts a lot.

 

12 hours ago, Maytham said:

I attempted to get PNG images displayed and I am getting a GDISP_IMAGE_ERR_NOMEMORY error, I still need to look into it to figure things out, however, I am able to display BMP images nicely without any loss in the image quality (at least for my eyes)

Decoding PNG images requires a lot of memory (compared to other formats). I guess in your case it's just a matter of increasing the stack size that you defined via GFX_OS_HEAP_SIZE in the configuration file. Note that in case of you're using an underlying operating system that provides a memory manager you want to set it to 0 instead so µGFX uses that memory manager instead of our own one.
You can get very detailed information about the RAM requirements for PNG image decoding here: https://wiki.ugfx.io/index.php/Images#PNG

Link to comment
Share on other sites

Hello Joel, 

Great, thank you, I will look forward to seeing official support for the board. I did actually end up increasing the heapsize in the config file after my last post and I managed to get the PNG images displayed on the screen, it was a bit slow, so I am looking into different ways where I can speed the process up.

Regards,

Edited by Joel Bodenmann
Removing unnecessary quote
Link to comment
Share on other sites

Hello Maytham,

I'm glad to hear that you managed to get PNG up and running.

Regarding the slowness: That is most likely (like, VERY likely) not related to the PNG images at all. We tested the driver from @inakto back then and we too experienced huge performance issues. This has either something to do with wrong clock setups or with using the wrong mode. The display controller/framebuffer that is on that display (the thing between the DSI and the actual display panel) supports different modes. The ones used by @inakto's driver is the video mode if i recall correctly which is not the best choice in this case.
However, I'm really not sure anymore.

On a side note, may I please ask you to stop quoting the entire previous post in your replies? Quotes are really just helpful if you refer to a specific piece of text, otherwise they make everything become very cluttered. You can just reply without making a quote at all if your reply is a follow-up on the last post(s). Otherwise, please just use partial quotes.

Link to comment
Share on other sites

  • 1 month later...

Hi all.

Since I've this board also STM32F469NIH I try to follow what you have done. But still not yet success, error. I use Eclipse and what I do is I follow step: 

I also use files of Maytham for the board driver. But for gdisp_IId_config.h ,I copy from ugfx>drivers>gdisp>STM32LTDC. I'm not sure I do it right or not.

This is what I do:

Manual How to implement uGFX lib in existing Eclipse project with autotool makefile.  

  1. Copy ugfx lib folder to your Eclipse project tree and exclude it from build( click right button on folder and choose Resource Configurations).
  2. Copy gfx_mk.c to your src from ugfx/src. Now all necessary sources and headers of ugfx include to build.
  3. Copy gfxconf.h to your include dir and config it. 
  4. Choose or create necessary drivers and board files (BSP). You can choose them from ugfx/drivers  and ugfx/boards. > I make folder and copy all files Maytham +  gdisp_IId_config.h inside folder.
  5. Specify following include paths: 

"../ugfx"

"../ugfx/src"
"STM32LTDC"

 

>> gfx.conf.h   I uncommend this 

#define GFX_USE_OS_RAW32                        TRUE

#define GFX_USE_GDISP                                TRUE (if I commend this line out then no error)

This is the error 

===================================================================================================================

00:18:51 **** Incremental Build of configuration Debug for project Copy of Copy of free_eclipse_org ****
make all 
Building file: ../src/gfx_mk.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DSTM32F469xx -DTRACE -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f4xx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\STM32LTDC" -std=gnu11 -MMD -MP -MF"src/gfx_mk.d" -MT"src/gfx_mk.o" -c -o "src/gfx_mk.o" "../src/gfx_mk.c"
In file included from C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src/gos/gos_mk.c:14:0,
                 from ../src/gfx_mk.c:9:
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src/gos/gos_raw32.c: In function '_gosInit':
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src/gos/gos_raw32.c:29:4: warning: #warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!" [-Wcpp]
   #warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
    ^
Finished building: ../src/gfx_mk.c
 
Building file: ../src/main.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DSTM32F469xx -DTRACE -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f4xx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\STM32LTDC" -std=gnu11 -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.c"
Finished building: ../src/main.c
 
Building target: Copy of Copy of free_eclipse_org.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"Copy of Copy of free_eclipse_org.map" --specs=nano.specs -o "Copy of Copy of free_eclipse_org.elf"  ./system/src/stm32f4xx/stm32f4xx_hal.o ./system/src/stm32f4xx/stm32f4xx_hal_cortex.o ./system/src/stm32f4xx/stm32f4xx_hal_dma.o ./system/src/stm32f4xx/stm32f4xx_hal_dma_ex.o ./system/src/stm32f4xx/stm32f4xx_hal_flash.o ./system/src/stm32f4xx/stm32f4xx_hal_flash_ex.o ./system/src/stm32f4xx/stm32f4xx_hal_flash_ramfunc.o ./system/src/stm32f4xx/stm32f4xx_hal_gpio.o ./system/src/stm32f4xx/stm32f4xx_hal_msp.o ./system/src/stm32f4xx/stm32f4xx_hal_pwr.o ./system/src/stm32f4xx/stm32f4xx_hal_pwr_ex.o ./system/src/stm32f4xx/stm32f4xx_hal_rcc.o ./system/src/stm32f4xx/stm32f4xx_hal_rcc_ex.o ./system/src/stm32f4xx/stm32f4xx_hal_tim.o ./system/src/stm32f4xx/stm32f4xx_hal_tim_ex.o  ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/assert.o  ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o  ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o  ./system/src/cmsis/startup_stm32f469xx.o ./system/src/cmsis/system_stm32f4xx.o  ./src/_write.o ./src/gfx_mk.o ./src/main.o ./src/stm32f4xx_it.o   
./src/gfx_mk.o: In function `gdispGClear':
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src/gdisp/gdisp.c:1030: undefined reference to `gdisp_lld_fill_area'
./src/gfx_mk.o: In function `_gdispInit':
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src/gdisp/gdisp.c:606: undefined reference to `GDISPVMT_OnlyOne'
collect2.exe: error: ld returned 1 exit status
makefile:62: recipe for target 'Copy of Copy of free_eclipse_org.elf' failed
make: *** [Copy of Copy of free_eclipse_org.elf] Error 1

00:18:52 Build Finished (took 1s.486ms)

===================================================================================================================

What I do wrong? I'm new in uGFX please advice. 

Thank you

1.jpg

Edited by nquantum
Link to comment
Share on other sites

It seem like I not yet in CubeMX enable LTDC... So I choose board STM32F469 Discovery and enable LTDC RGB888(24bit) DSI mode. leave other non touch. Then try again. Got this error about gdisp_colors.

Can you please help me on this? Any hints?

uilding file: ../src/main.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DSTM32F469xx -DTRACE -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f4xx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx\src" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\STM32LTDC" -I"C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\Myfiles" -std=gnu11 -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.c"
In file included from C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp.h:212:0,
                 from C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/gfx.h:208,
                 from ../src/main.c:37:
../src/main.c: In function 'MX_LTDC_Init':
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:87:16: note: in expansion of macro 'HTML2COLOR'
 #define Blue   HTML2COLOR(0x0000FF)
                ^
../src/main.c:184:24: note: in expansion of macro 'Blue'
   hltdc.Init.Backcolor.Blue = 0;
                        ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:91:17: note: in expansion of macro 'HTML2COLOR'
 #define Green   HTML2COLOR(0x008000)
                 ^
../src/main.c:185:24: note: in expansion of macro 'Green'
   hltdc.Init.Backcolor.Green = 0;
                        ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:88:16: note: in expansion of macro 'HTML2COLOR'
 #define Red    HTML2COLOR(0xFF0000)
                ^
../src/main.c:186:24: note: in expansion of macro 'Red'
   hltdc.Init.Backcolor.Red = 0;
                        ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:87:16: note: in expansion of macro 'HTML2COLOR'
 #define Blue   HTML2COLOR(0x0000FF)
                ^
../src/main.c:204:23: note: in expansion of macro 'Blue'
   pLayerCfg.Backcolor.Blue = 0;
                       ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:91:17: note: in expansion of macro 'HTML2COLOR'
 #define Green   HTML2COLOR(0x008000)
                 ^
../src/main.c:205:23: note: in expansion of macro 'Green'
   pLayerCfg.Backcolor.Green = 0;
                       ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:88:16: note: in expansion of macro 'HTML2COLOR'
 #define Red    HTML2COLOR(0xFF0000)
                ^
../src/main.c:206:23: note: in expansion of macro 'Red'
   pLayerCfg.Backcolor.Red = 0;
                       ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:87:16: note: in expansion of macro 'HTML2COLOR'
 #define Blue   HTML2COLOR(0x0000FF)
                ^
../src/main.c:224:24: note: in expansion of macro 'Blue'
   pLayerCfg1.Backcolor.Blue = 0;
                        ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:91:17: note: in expansion of macro 'HTML2COLOR'
 #define Green   HTML2COLOR(0x008000)
                 ^
../src/main.c:225:24: note: in expansion of macro 'Green'
   pLayerCfg1.Backcolor.Green = 0;
                        ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:329:25: error: expected identifier before '(' token
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                         ^
C:\Users\nquan\Documents\3 Projects\Eclipse ARM\-tableARM-\Copy of Copy of free_eclipse_org\ugfx/src/gdisp/gdisp_colors.h:88:16: note: in expansion of macro 'HTML2COLOR'
 #define Red    HTML2COLOR(0xFF0000)
                ^
../src/main.c:226:24: note: in expansion of macro 'Red'
   pLayerCfg1.Backcolor.Red = 0;
                        ^
src/subdir.mk:27: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1

23:33:03 Build Finished (took 9s.820ms)

 

Link to comment
Share on other sites

In your main.c after including gfx.h you will need to #undef Red, Green and Blue.

Both the Stm32 hal and ugfx define these symbols but they unfortunately define them differently. As you are using the stm32 style reference to them using the undef after including ugfx.h should enable that to work.

Typically we put such hardware specific code into a different source file that doesn't include ugfx.h. Your main.c can then be clean normal ugfx code.

Link to comment
Share on other sites

After undef Red, Green, Blue after import gfx.h I also add some into board_STM32LTDC.h due to little error. 

DSI_HandleTypeDef hdsi_eval;
uint32_t lcd_x_size;
uint32_t lcd_y_size;

Then compile project without error , Module GWIN, GOS, GDISP, GINPUT now compile without error. ("Yesssss!!...") However... I feel that undef Red, Green, Blue may still cause some error when I try use demo module of ugfx....

But here I try to load in to STM32F469i board... It almost work now. But I try to solve this not sure where to start. Please help me.

 

I've read that before I call  gfxInit() I've to initial peripheral before right? But I call gfxInit() with demo code from gdisp module after 

HAL_Init();
SystemClock_Config();

BSP_SDRAM_Init();

Nothing on screen, black screen. But if I call call gfxInit() , demo code after 

HAL_Init();
SystemClock_Config();
BSP_SDRAM_Init();

lcd_status = LCD_Init();

or
 

HAL_Init();

SystemClock_Config();
BSP_SDRAM_Init();

lcd_status = LCD_Init();
BSP_LCD_LayerDefaultInit(0, LAYER0_ADDRESS);
BSP_LCD_SelectLayer(0); 

It seem to work like the picture I show you.

 

I setup the project of STM32F469 from the example project come from ST , LCD_DSI_CmdMode_SingleBuffer once then compile without error then I add uGFX into it.

I does because LCD initial not correctly? 

Does the uGFX GDISP do initial LCD and LTDC/DMA2D automatic or do I need to initial myself with BSP function from ST before I call gfxInit()

 

Sorry for confuse question. Because I don't know which one to begin 1st or what cause of this.

IMG20170113151956.jpg

Link to comment
Share on other sites

I think I have a clue. I maybe about DSI and/or LTDC clock initial...

/* STM32F4xx HAL library initialization:
    - Configure the Flash prefetch, instruction and Data caches
    - Systick timer is configured by default as source of time base, but user 
      can eventually implement his proper time base source (a general purpose 
      timer for example or other time source), keeping in mind that Time base 
      duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
      handled in milliseconds basis.
    - Set NVIC Group Priority to 4
    - Low Level Initialization: global MSP (MCU Support Package) initialization
  */
  HAL_Init();

  /* Configure the system clock to 180 MHz */
  SystemClock_Config();

  // ugfx //

  // test clock //

     /* LCD clock configuration */
     /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
     /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 417 Mhz */
     /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 417 MHz / 5 = 83.4 MHz */
     /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 83.4 / 2 = 41.7 MHz */
     PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
     PeriphClkInitStruct.PLLSAI.PLLSAIN = 417;
     PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
     PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
     HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);

  // end test clock //

once I copy some clock-setting code from ST example function "LCD_Init" just before uGFX code: and also before BSP_SDRAM_Init();

Since I see SDRAM initial already in  board_STM32LTDC.h

Once try then LCD show picture like this. Still I need to solve why it so mess. 

Again, please help me solve

IMG20170113194417.jpg

Link to comment
Share on other sites

I do try change 

PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;

to 

PeriphClkInitStruct.PLLSAI.PLLSAIR = 4;

I got this.

I've no idea what I've done. Guess is clock setting is not correct. What really happen?

And also seem to not in sync or something.

 

 

IMG20170113195254.jpg

IMG20170113200128.jpg

Edited by nquantum
Link to comment
Share on other sites

On 1/13/2017 at 10:24, nquantum said:

Does the uGFX GDISP do initial LCD and LTDC/DMA2D automatic or do I need to initial myself with BSP function from ST before I call gfxInit()

Initializing the required peripherals is the job of the init() function in the driver and the init() function in the board file. The driver has to take care of doing driver specific initialization. In this case that means setting up the LTDC and other things that are required to use that driver no matter what actual board is used (eg. the pin configuration from one board to the other can be different although both use the LTDC driver). The board file init() on the other hand is responsible for initializing things that are specific to that board. Those are usually just the pin configurations.

 

The images you're showing definitely suggest an issue with the clock setup. However, unfortunately I don't have time right now to dive into the datasheet and corresponding examples - that would take a lot of time.
Could you simply have a look at the example that @Maytham and/or @inakto created? They have a working setup - it's just not properly integrated in terms of the driver level of uGFX but they are able to properly display things which means that they set up the clocks correctly.

 

Link to comment
Share on other sites

I've checked for long time. Clock is cause of that image like non-smooth. This is what I do :

1.) Add LTDC clocking setting into init_board(GDisplay* g)  

It seem like gdisp_lld_STM32LTDC.c don't set it

Without add this I got black screen. Once I add code it show picture as normal.

  /* LCD clock configuration */
  /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
  /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 384 Mhz */
  /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 384 MHz / 7 = 54.857 MHz */
  /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 54.857 MHz / 2 = 27.429 MHz */
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
  PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
  PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;
  PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);

2.) Change value of "Horizontal, Vertical sync (pixels)"  

static const ltdcConfig driverCfg = {
	800, 480,								// Width, Height (pixels)
	120, 12,                                // Horizontal, Vertical sync (pixels)
	120, 12,						    	// Horizontal, Vertical back porch (pixels)
	120, 12,								// Horizontal, Vertical front porch (pixels)
	0,										// Sync flags
	0x000000,								// Clear color (RGB888)

from  

120, 12,                  // Horizontal, Vertical sync (pixels) 

to 

63, 12,                  // Horizontal, Vertical sync (pixels)

This value come from file stm32469i_discovery_lcd.c 

  /* The following values are same for portrait and landscape orientations */
  VSA  = OTM8009A_480X800_VSYNC;        /* 12  */
  VBP  = OTM8009A_480X800_VBP;          /* 12  */
  VFP  = OTM8009A_480X800_VFP;          /* 12  */
  HSA  = OTM8009A_480X800_HSYNC;        /* 63  */
  HBP  = OTM8009A_480X800_HBP;          /* 120 */
  HFP  = OTM8009A_480X800_HFP;          /* 120 */

For some reason if I use same value 120,12 it will black-screen. Once I change it show as normal.

 

But here is problem.

Look like screen is offset to the down and right. I don't know why.

I guess it is something to do with LTDC init, DSI init either on board file or gdisp_IId_STM32LTDC.c file. 

Pictures show that I fill 10pixel of the edge but display show other thing shift to the down-right.

I don't know where to look for now, have done and try a lot already. Please help. How or Where to solve this, what cause this?

This is in my main.c

	  // Get the screen size
      width = gdispGetWidth();
      height = gdispGetHeight();
      trace_printf("width= %d\n", width);
      trace_printf("height= %d\n", height);


      // Code Here
      gdispDrawLine(0, 0, width, height, Red);
      gdispDrawLine(0, height, width, 0, Blue);
      gdispDrawLine(0, height/2, width, height/2, Green);
      gdispDrawLine(width/2, 0, width/2, height, White);
      gdispFillArea(0+10, 0+10, width-10, height-10, Yellow);

 

thumbnail_IMG20170121200410.jpg

thumbnail_IMG20170121200412.jpg

thumbnail_IMG20170121225629.jpg

IMG20170121230957.jpg

Edited by nquantum
Link to comment
Share on other sites

Great work at getting this almost working, @nquantum! I'm really sorry that we can't help more right now, we're drowning in work! Usually we can give some pointers in order to push you towards the correct direction but unfortunately we have never worked with this DSI/MIPI stuff ourselves before. In fact, @nathan.loretan might be the most experienced one with that around here. Maybe he can give you a hint ;)
He certainly has the display working in the video mode and I suspect that the offset issue is based on a timing issue (eg. wrong display panel parameters) which would be the same for the video and the adaptive command mode. I'll ask him to check this out.

My recommendation is to get the correct timings out of the ST board files. I have them somewhere in an uGFX STM32LTDC compatible manner on my computer but that computer is currently not where I am.

Link to comment
Share on other sites

2 hours ago, nquantum said:

Really don't know why it seem to offset from 0,0

Hi nquantum, 

I remember having a similar issue with offsets from 0,0 when I was implementing my project. 

If I remember correctly I had to change something in the gdisp_lld_STM32LTDC.c file:
specifically, inside the _ltdc_init function:

    // Enable the LTDC clock
    #if defined(STM32F469xx)
        RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR);
    #elif defined(STM32F4) || defined(STM32F429_439xx) || defined(STM32F429xx)
        RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | (1 << 16);
    #elif defined(STM32F7) || defined(STM32F746xx)
        RCC->DCKCFGR1 = (RCC->DCKCFGR1 & ~RCC_DCKCFGR1_PLLSAIDIVR) | (1 << 16);
    #else
        #error STM32LTDC driver not implemented for your platform
    #endif

I added the define part for STM32F469xx and I believe that fixed the offset, or at least it was the first step at getting the offset removed. 

Hope this helps,

Maytham

Link to comment
Share on other sites

Hi Maytham thank for reply. For your info I'm outside I will investigate more tonight.

I use values from ST example HAL

      VSA  = OTM8009A_480X800_VSYNC;        /* 12  */
      VBP  = OTM8009A_480X800_VBP;          /* 12  */
      VFP  = OTM8009A_480X800_VFP;          /* 12  */
      HSA  = OTM8009A_480X800_HSYNC;        /* 63  */
      HBP  = OTM8009A_480X800_HBP;          /* 120 */
      HFP  = OTM8009A_480X800_HFP;          /* 120 */

Clearly it make offset large , once I change back to your value HSA   from 63 > 120. I much better.

Still 2-3pixel offset horizaltal/vertical. As the dirty-workaround I do that I get picture below is.

       gdispDrawLine(0, height-1, width, height-1, White);    //show up
       gdispDrawLine(0, height-2, width, height-2, White);    //show down
       gdispDrawLine(width-2, 0, width-2, height, White);    //show left
       gdispDrawLine(width-3, 0, width-3, height, White);    //show right

 

It seem that you enable clock in  gdisp_lld_STM32LTDC.c 

But I remember that I do quite difference from you. I enable clock in board_STM32LTDC.h file and comment out clock enable in gdisp_lld_STM32LTDC.c

You seem to set LTDC clock by assign PLLSAIR only. How can LTDC clock can be set correctly and enable? There no need to assign PLLSAIN, PLLSAIR_POST and RCC->CR |= RCC_CR_PLLSAION?

Or there is somewhere else you do in main.c?

 

I got black screen if I remember correct. So I try set clock of LTDC in board_STM32LTDC.h this :

    // KoD LCD clock configuration
    // PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz
    // PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 384 Mhz
    // PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 384/7 = 54.857 Mhz
    // LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 54.857/2 = 27.429Mhz
    #define STM32_PLLSAIN_VALUE                 384
    #define STM32_PLLSAIQ_VALUE                 4
    #define STM32_PLLSAIR_VALUE                 7
    #define STM32_PLLSAIR_POST                  STM32_SAIR_DIV2

  RCC->PLLSAICFGR = (STM32_PLLSAIN_VALUE << 6) | (STM32_PLLSAIR_VALUE << 28) | (STM32_PLLSAIQ_VALUE << 24);
  RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | STM32_PLLSAIR_POST;
  RCC->CR |= RCC_CR_PLLSAION;

 

What do you think?

I will more investigate tonight.

 

IMG20170124141434[266].jpg

Edited by nquantum
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...