dynfer Posted April 7 Report Posted April 7 Hello, I'm currently implementing uGFX on a STM32H743iit6 with an 1024x600 screen via LTDC (rgb565). I'm running in some problems where the code from below doesn't render properly. What could be the cause? #include "ch.h" #include "hal.h" #include "gfx.h" #include "gfx_thread.h" GListener glistener; static THD_WORKING_AREA(waGUI, 512); static THD_FUNCTION(GUIThread, arg) { (void)arg; gfxInit(); geventListenerInit(&glistener); gwinAttachListener(&glistener); const font_t font = gdispOpenFont("DEJAVUSANS10"); GDisplay * g = gdispGetDisplay(0); gCoord width, height; width = 512; height = 300; while (true) { chThdSleepMilliseconds(1500); gdispClear(Black); gdispDrawString(10, 10, "Hello, uGFX with ChibiOS!", font, White); chThdSleepMilliseconds(1500); gdispDrawCircle(g, (width, height), 150, Yellow); } } void startGFX(void) { chThdCreateStatic(waGUI, sizeof(waGUI), NORMALPRIO, GUIThread, NULL); } Like seen in the picture the font is disorted and the circle isn't drawn in the center of the screen, however the Y axis seems to be ok?
Joel Bodenmann Posted April 7 Report Posted April 7 Hello & Welcome to the µGFX community! Could you please tell us which version of the µGFX library you're using (eg. v2.9 release or the git master branch, ...) and whether you're using a development kit (such as STM32 discovery or similar) or whether you're using custom hardware?
dynfer Posted April 7 Author Report Posted April 7 (edited) 11 minutes ago, Joel Bodenmann said: Hello & Welcome to the µGFX community! Could you please tell us which version of the µGFX library you're using (eg. v2.9 release or the git master branch, ...) and whether you're using a development kit (such as STM32 discovery or similar) or whether you're using custom hardware? Hello Joel, Thanks for responding! Im using 2.9 release from the main website. The board in question is an Alieexpress dev board featuring an h743/256Mbit SDRAM and LTDC screen. As for ChibiOS its the current master branch v21 //Update, the following code results in the following #include "ch.h" #include "hal.h" #include "gfx.h" #include "gfx_thread.h" GListener glistener; static gdispImage myImage; static THD_WORKING_AREA(waGUI, 512); static THD_FUNCTION(GUIThread, arg) { (void)arg; gfxInit(); geventListenerInit(&glistener); gwinAttachListener(&glistener); const font_t font = gdispOpenFont("DEJAVUSANS10"); GDisplay * g = gdispGetDisplay(0); while (true) { chThdSleepMilliseconds(200); gdispGClear(g, Black); gdispGFlush(g); gdispGDrawString(g, 20, 20, "Hello from ChibiOS with UGFX", font, Yellow); gdispGFlush(g); chThdSleepMilliseconds(200); gdispGDrawCircle(g, 256, 300, 150, Yellow); gdispGFlush(g); gdispGDrawChar(g, 256, 300, "X", font, Blue); gdispGFlush(g); } } void startGFX(void) { chThdCreateStatic(waGUI, sizeof(waGUI), NORMALPRIO, GUIThread, NULL); } Edited April 7 by dynfer
Joel Bodenmann Posted April 7 Report Posted April 7 So, generally the good news is that once you see something on the screen (anything, even if it's distorted), you're generally in good shape. It's usually harder to get to the point where you're no longer staring at a black screen. First of all, I would recommend that you use the current `master` branch of the official µGFX v2 git repository: https://git.ugfx.io/ugfx/ugfx One of the notable changes after the v2.9 release was a rework of the STM32 LTDC driver. You can (and should) read more about the changes here: I think it's wasted effort to debug the issue you're currently having with the old driver. I'd suggest that you get it up and running with the new driver and then we figure out what isn't working for you. Don't hesitate to ask if you have any questions. We're happy to help wherever we can.
dynfer Posted April 7 Author Report Posted April 7 (edited) 1 hour ago, Joel Bodenmann said: So, generally the good news is that once you see something on the screen (anything, even if it's distorted), you're generally in good shape. It's usually harder to get to the point where you're no longer staring at a black screen. First of all, I would recommend that you use the current `master` branch of the official µGFX v2 git repository: https://git.ugfx.io/ugfx/ugfx One of the notable changes after the v2.9 release was a rework of the STM32 LTDC driver. You can (and should) read more about the changes here: I think it's wasted effort to debug the issue you're currently having with the old driver. I'd suggest that you get it up and running with the new driver and then we figure out what isn't working for you. Don't hesitate to ask if you have any questions. We're happy to help wherever we can. Thanks I've did the switch with the results in the attachments, I've also changed the font size to 32 to show the defects better. Additionally gdispGFillArea(g, 0, 0, 1024, 600, Blue) doesnt seem to work. //Update the issues were caused by my DMA2D clocks not being initialized. Afterwards its working as expected. Edited April 7 by dynfer update
Joel Bodenmann Posted April 7 Report Posted April 7 Great that you got the new driver working so quickly - nice work! 15 minutes ago, dynfer said: //Update the issues were caused by my DMA2D clocks not being initialized. Afterwards its working as expected. Does everything work properly then? The font looks a bit funky but maybe that's just the font. You can always test with the built-in DejaVu fonts first to confirm that it's working as intended.
dynfer Posted April 7 Author Report Posted April 7 4 minutes ago, Joel Bodenmann said: Does everything work properly then? The font looks a bit funky but maybe that's just the font. You can always test with the built-in DejaVu fonts first to confirm that it's working as intended. For now everything seems to work fine :). The font disortion was caused by the DMA2D not working. Now its looking good. However the questions are not over I want to test an image, I've used "lcd-image-converter" to generate a byte array, I've included the header as the first 8 elements like follows: 0x4E, 0x49, (1024 & 0xFF), ((1024 >> 8) & 0xFF), (600 & 0xFF), ((600 >> 8) & 0xFF), (0x2565 & 0xFF) But I struggle to find the correct function to draw it.
Joel Bodenmann Posted April 7 Report Posted April 7 µGFX supports file formats like BMP, GIF and PNG out of the box. You can directly load the encoded image. No need to use an image converter. You can use the NATIVE format but then you'll indeed have to do the conversion yourself. The easiest way to get an image is to include it in your firmware image. This can be done with the file2c utility that ships with the µGFX library. You can then use ROMF to display it. Have a look at the /demos/modules/gdisp/images demo to get started. Also, here's more documentation: https://wiki.ugfx.io/index.php/Images For the future, please make a separate forum topic/thread. This makes it much easier for other people to find answers to similar questions in the future
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now