doc_rob Posted April 28, 2017 Report Share Posted April 28, 2017 Hello everyone, this is my first attempt with ugfx library and I need some help starting with my 1.8 inch display. I found the driver in gdisp and modified a board file from a different example but now it won't compile. Does anyone have a working example preferably for a stm32f4 and Chibios. That would be a great help. Thank you. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted April 28, 2017 Report Share Posted April 28, 2017 Hello @doc_rob and welcome to the µGFX community! There are plenty of example board files that you can find in the /boards directory of the µGFX library. However, it would be a lot more efficient if you could simply attach a plain text file of the compiler output (make sure that you make a clean build). This way we can see what's going on and help you resolving your problems. Link to comment Share on other sites More sharing options...
doc_rob Posted April 28, 2017 Author Report Share Posted April 28, 2017 Of course, I will do that as soon as I am at home. Also i will look in the boards folder. Thank you for the suggestion. Link to comment Share on other sites More sharing options...
doc_rob Posted April 28, 2017 Author Report Share Posted April 28, 2017 Unfortunately i couldn't get a working configuration. Here are some of my errors. I am pretty sure there is an error in gdisp_lld_ST7735.c in the function execute_cmds: static void execute_cmds (const uint8_t *addr) { unsigned int cmds = *addr++; while (cmds--) { write_cmd (g, *addr++); ... it doesn't get g. Some more errors: ../../ugfx_2.7/drivers/gdisp/ST7735/gdisp_lld_ST7735.c:90:18: error: #if with no expression #if ST7735_TYPE_B ../../ugfx_2.7/drivers/gdisp/ST7735/gdisp_lld_ST7735.c:204:14: error: 'g' undeclared (first use in this function) write_cmd (g, *addr++); ../../ugfx_2.7/drivers/gdisp/ST7735/gdisp_lld_ST7735.c:84:101: error: expected ';' before '}' token #define write_data_repeat(g, data, count) { int i; for (i = 0; i < count; ++i) write_data (g, data) } It would be very helpful if somebody could supply a working example. Thank you. Link to comment Share on other sites More sharing options...
cpu20 Posted May 1, 2017 Report Share Posted May 1, 2017 I've tried compiling a project with the st7735 driver and indeed it throws these errors. I tried to fix some of them but now I get linking problems. I'll try to look into it tomorrow. Link to comment Share on other sites More sharing options...
cpu20 Posted May 2, 2017 Report Share Posted May 2, 2017 If you have written the board_ST7735.h file yourself you should be able to get it working with this µGFX version: https://github.com/cpu20/uGFX-ST7735-fix- Let me know if it compiles for you. Link to comment Share on other sites More sharing options...
doc_rob Posted May 2, 2017 Author Report Share Posted May 2, 2017 It looks like you did make exactly the same two changes as i. It does compile but sadly the display isn't too impressed, meaning it still doesn't work. Maybe there is some initialisation missing, i did compare the init with the adafruit source and it is somewhat shorter. I assume the creator had just one type of display and didn't need the other code. I have to check with my logic analyzer. But for now it is still non functional. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 2, 2017 Report Share Posted May 2, 2017 That driver actually shouldn't be part of the library anymore, we wanted to throw it out a couple of months ago but seems that we never actually did it. The reason for that is because it appears that the author of the driver (a member of the community) just simply copy-pasted the Adafruit driver and when I remember correctly the Adafruit license doesn't allow for that. We'd appreciate it if you guys could develop a proper µGFX driver from ground up. Link to comment Share on other sites More sharing options...
doc_rob Posted May 3, 2017 Author Report Share Posted May 3, 2017 I've been playing with this driver for a while now and i've got it working (more or less). But one problem i can't solve. After the initialization the screen gets cleared but only half way (actually from the 120Lines about 50). I tried delays after one command byte, after one data byte, slower SPI clock, i changed GDISP_LINEBUF_SIZE but nothing changed. GDISP_SCREEN_HEIGHT is 120 and GDISP_SCREEN_WIDTH is 128. Is there somewhere a configuration in uGFX i missed? I am using uGFX 2.4 now. Thanks. Link to comment Share on other sites More sharing options...
doc_rob Posted May 3, 2017 Author Report Share Posted May 3, 2017 Also the colors are wrong, for example Yellow is blue. White and black are correct. Where can i change that? Link to comment Share on other sites More sharing options...
inmarket Posted May 3, 2017 Report Share Posted May 3, 2017 That will be the GDISP_PIXELFORMAT in the gdisp_lld_conf.h file. Change RGB to BGR or visa versa. Alternatively their is usually a controller init command the controls the pixrl direction. Link to comment Share on other sites More sharing options...
doc_rob Posted May 4, 2017 Author Report Share Posted May 4, 2017 GDISP_PIXELFORMAT does slightly change the wrong colors to a different wrong. For example: with RGB565 it is as follows: Red = Black, Green = Black, Blue = Yellow, Yellow = Blue, Magenta = Yellow with BGR565: Red = Yellow, Green = Black, Blue = Black, Yellow = White, Magenta = Yellow Also there are some warnings during compile: WGDISP_PIXELFORMAT_CUSTOM" is not defined "GOS_NEED_X_THREADS" is not defined "GOS_NEED_X_HEAP" is not defined "GFX_USE_GAUDIN" is not defined Are they in any way related to my problem? Thank you. Link to comment Share on other sites More sharing options...
inmarket Posted May 5, 2017 Report Share Posted May 5, 2017 Looks like you have broken something with that change. Better to put it back to what it was as the likely problem for both symptoms is an error in the initialisation sequence. Link to comment Share on other sites More sharing options...
doc_rob Posted May 5, 2017 Author Report Share Posted May 5, 2017 Ok, i did it. I've spend a lot of time checking other code and looking at the datasheet of the controller. The Problem was simple, GDISP_HARDWARE_FILLS was TRUE and that caused the Problem. I just need some Help with the colors. It seems GREEN is not been transfered. I tried RGB, BGR. The config is right for sure but somewhere the calculation from Yellow for example which is defined as HTML2COLOR(0xFFFF00) is wrong and i end up with Blue or Black. I've come that far i really don't want to trash everything now. So, to be clear, could anyone please help me with figuring out the color problems. Thank you. Link to comment Share on other sites More sharing options...
doc_rob Posted May 6, 2017 Author Report Share Posted May 6, 2017 I found the problem and a solution. The driver works now corectly (at least for my GREENTAB display). What's odd is the display has printed on 128*120 but Resolution is 128*160. I used uGFX 2.7 and ChibiOS 16.1 Can i upload my project somewhere? Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 6, 2017 Report Share Posted May 6, 2017 Glad to hear that you managed to get it up and running. You can post your project in the user projects section: https://community.ugfx.io/forum/6-user-projects/ 2 hours ago, doc_rob said: What's odd is the display has printed on 128*120 but Resolution is 128*160. I used uGFX 2.7 and ChibiOS 16.1 What do you mean by "printed on"? On the PCB? Link to comment Share on other sites More sharing options...
doc_rob Posted May 6, 2017 Author Report Share Posted May 6, 2017 Yes it is printed on the PCB. You can see it here: (http://www.ebay.com/itm/1-8-inch-Full-Color-128x160-SPI-TFT-LCD-Display-Module-Replace-OLED-for-Arduino-/262337581178?hash=item3d1489d07a:g:Rc8AAOSwepJXWQhi) It even says 128x160 in the title despite whats on the PCB. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 6, 2017 Report Share Posted May 6, 2017 Well, those modules are made to be as cheap as possible. It's very likely that they re-use the same PCB from another module. Not much we can do about that. At least it helps to keep the price down Link to comment Share on other sites More sharing options...
doc_rob Posted May 6, 2017 Author Report Share Posted May 6, 2017 For sure it is better this way than buying a 128x160 Module with 128x120 Resolution. I'll post my project shortly. Now i finally can start to play with uGFX. So much to discover .... Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 6, 2017 Report Share Posted May 6, 2017 Sounds great! Publishing your project will definitely help others in the future Don't hesitate to ask if you have any questions. We're happy to help wherever we can. Link to comment Share on other sites More sharing options...
doc_rob Posted May 6, 2017 Author Report Share Posted May 6, 2017 I probably will Link to comment Share on other sites More sharing options...
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