Jump to content

STM32F103 + ST7735


baev_al

Recommended Posts

Hello.

I'm just started to quest through the uGFX. Does it make sence to use it with the attached schematic? I made the lcd work sending commands vis SPI. It seems I need to form this into driver... Can you please advise me what part of the documentation should I read?

Thanks

mcu.thumb.jpg.9bee3d46338800f3a9a9bb52f3

Link to comment
Share on other sites

Hello and welcome to the community!

You will definitely be able to run uGFX on that hardware and it also makes sense to do so ;)

What display are you using? If the display module uses a controller that's already supported by the uGFX library then you don't have to do anything but implementing the board file. The board file contains a few functions which you have to implement so they send and receive data through SPI in your case.

You can find a list of all implemented drivers here: http://ugfx.org/platforms

In case of your display controller is not yet supported you'll have to implement the driver yourself. We recommend having a look at some of the numerous existing drivers.

Everything we have to offer in terms of documentation can be found here: http://wiki.ugfx.org

If you have any questions do not hesitate to ask. We are happy to help where we can.

~ Tectu

Link to comment
Share on other sites

What display are you using? If the display module uses a controller that's already supported by the uGFX library then you don't have to do anything but implementing the board file. The board file contains a few functions which you have to implement so they send and receive data through SPI in your case.

In case of your display controller is not yet supported you'll have to implement the driver yourself. We recommend having a look at some of the numerous existing drivers.

Thank you for your support.

I'am using a display with ST7735S driver. It seems there is no support for it yet.

As an example I took SSD1289 driver.

Am I right that my task is to make work the following functions (which use the functions communicating with hardware):

set_cursor(GDisplay *g)

set_viewport(GDisplay* g)

gdisp_lld_init(GDisplay *g)

Where is exactly the function sending the data to the LCD?

Should I deal with dummy_read(g)?

I added functions sending data and commands to board_ST7735S.h file as well as LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g).

Here is the part of the main() function:

gfxInit();

gdispGDrawLine(g, 0,0, 128, 128, 0xFF);

When I step throug the last function I achieve Hard Fault when the programm tries to reach drawpixel(g) in gdisp.c.

What did I do wrong?

Link to comment
Share on other sites

The problem with Hard Fault is solved. I used gdispGxxxx function - so I needed to create an GDisplay variable - and that caused a problem. I changed the function to gdispXxxx.

Now I have another problem.

In gfxconfig.h I defined

#define GDISP_HARDWARE_DRAWPIXEL TRUE

I added the function to the .c driver file


#if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
{
LcdSendCommand(ST7735_CASET);
LcdSendData(0x00);
LcdSendData(g->p.x);
LcdSendCommand(ST7735_RASET);
LcdSendData(0x00);
LcdSendData(g->p.y);
LcdSendCommand(ST7735_RAMWR);
LcdSendData(g->p.color);
}
#endif

But I never get here. Stepping through the code showed that in this part of the code (gdisp.c)


static GFXINLINE void drawpixel(GDisplay *g) {

// Best is hardware accelerated pixel draw
#if GDISP_HARDWARE_DRAWPIXEL
#if GDISP_HARDWARE_DRAWPIXEL == HARDWARE_AUTODETECT
if (gvmt(g)->pixel)
#endif
{
gdisp_lld_draw_pixel(g);
return;
}

when I try to step into gdisp_lld_pixel(g) the program just steps over...

Link to comment
Share on other sites

It's correct to use gdispXxx() instead of gdispGxxx() as mentioned in the documentation. You only need the one that takes the display parameter if you are working with multiple displays (if you have more than one display connected to your microcontroller).

First of all I would like to point you to the documentation that explains the GDISP driver interface. It contains some valuable information that might be helpful to understand what happens: http://wiki.ugfx.org/index.php?title=Di ... iver_Model

I assume that the reason that your gdisp_lld_draw_pixel() isn't getting called is because in your drivers configuration file you enabled some hardware accelerated drawing method. It's either possible that you set GDISP_HARDWARE_DRAWPIXEL to TRUE or that you enabled hardware accelerated area filling and you're trying to draw a rectangle in which case the GDISP code will use the hardware acceleration interface instead of gdisp_lld_draw_pixel().

When implementing it's a good idea to disable all hardware acceleration first.

An additional comment: I'd strongly recommend you to stick with the current existing naming conventions that are also used by the other drivers. You can see that the SSD1289 driver's board file functions are called write_reg() and write_data().

I hope that helps. Let us know when you have any additional questions.

~ Tectu

Link to comment
Share on other sites

I did try the ST7735 and also the similar ILI9163 with uGFX and found that the easiest way was to start from the ILI9341 driver.

The only thing that needs changing was the init sequence for the display chip to get it running.

There is already an working example in boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h.

Even though this is for the STM32F4xx I had no problems using it.

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...
  • 4 weeks later...
  • 2 weeks later...

Hi,

I've just wrote uGFX ST7735 driver for my board. https://git.ugfx.io/olegator77/uGFX/src/master/drivers/gdisp/ST7735

It is basically working (at least with my ST7735 display). It seems, that on market number of slightly different modifications of ST7735, therefore may be necessary to adjust driver settings. 

RIght now this driver not support power control and reading back. 

 

Link to comment
Share on other sites

Hello @olegator !

That's quite a coincidence, I just received the ST7735 based display module that I ordered as mentioned above. I guess there's not much fun left for me to do then :P
Thank you very much for contributing this driver. We will have a look at it and include it in the repository eventually (you might want to pull request as soon as you think that it's ready).

Link to comment
Share on other sites

Unfortunately i've broke my board with ST7735, and right now can't continue test it. Last time, when i seen it, driver was working fine and stable and seems usefull for 99% cases.

But pixel reading and power control still not implemented   So, i can make right now pull request with current version.  When i'll repair board, i can make additional request with pixel reading and power control.

Link to comment
Share on other sites

I am sorry to hear that you broke your display module :( 
If the driver works so far please feel free to pull request it. It can always be improved later on. Important is that the usual display features are working. There are many drivers in the repository that don't implement the full set of power modes and so on yet.

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...