Jump to content

Getting started with E-paper displays


Ken_1

Recommended Posts

Hello,

First, I'm not sure if this is the right forum for this post, so my apologies if I've come to the wrong place.

I am completely new to uGFX, and have not even downloaded it yet.  I'd like to ask first if it will meet my purposes, as follows.

I am a hobby electronics enthusiast, retired from a working life in electronics.

My preferred uP is from the Microchip PIC18 range (specifically PIC18F25K50).  I use the MPLABX IDE platform with XC8 compiler.  I am far from expert in C code, but have learnt enough to be comfortable with the Microchip methods and libraries.

My projects usually involve displays of one form or another.  Up 'til now I have used small LCD and OLED panels, and am well familiar with driving them.  I now want to experiment with E-paper displays, and have decided to start with the Waveshare 2.13inch E-paper HAT board.  It uses an SPI interface.

I have downloaded example code for this Waveshare part, from Waveshare itself and a few other sources.  I had hoped to hack example code to suit my PIC18, but there is a major hurdle which I cannot get past, namely all example code seems to be written in CPP, which is no use with the XC8 compiler.  Microchip do not offer a CPP compiler for their 8 bit parts, and it is beyond my abilities to translate the CPP code to C.

SO -- I wonder if uGFX can help me here ?
Can it generate code to drive this Waveshare display ?
How will it link in with MPLABX IDE ?
Does it generate C code ?
I am not even sure if these are sensible questions, and I suspect there are others I should be asking.

Can you offer any advice?

Many thanks.

Link to comment
Share on other sites

uGFX is a graphics library that makes abstraction from the hardware that you use. So you can write a prom that uses the uGFX library to draw things on the screen, reads user input etc.. without knowing what hardware you are using (in theorie).
To make the program work with your specific hardware setup, a gdisp driver must be written for your hardware setup. All existing drivers can be found in drivers/gdisp (take a look there to get an idea). The display driver file is called gdisp_lld_xxx.c

So in order to make uGFX work with your EPaper display you need to write a driver for it. An example of a driver for an EPaper display can be seen here:

After writing the display driver, there is also a file needed that implements the interface between your specific MCU and the display. This file is called board_xxx.h
The board file includes functions that send data to the display over a certain interface (depending on the display used). In your case the display uses SPI so the board file will contain functions that use SPI to send data to the display. For an example see the post above.

To summarize, you will have to write a driver (gdisp_lld_xxx.c) for your EPaper display and a board file (board_xxx.h) that implements the SPI interface between your MCU and the display.

If you have any questions don't hesitate to ask.

EDIT: I did a quick google and it seems that the 2.9inch and 2.13inch EPapers are quite the same. It might be possible to copy the driver in the post above and just change the resolutions of the display in gdisp_lld_xxx.c

Edited by cpu20
Link to comment
Share on other sites

There are a few EPaper drivers already in the repository that you can use as a template.

The ED060SC4 driver handles an EPaper display without a controller chip.

The UC8173 driver is probably the most complete EPaper driver, even supporting loading of temperature and waveform profiles.

I think the UC1610 is also an EPaper controller.

I don't know how close any of those are to the HAT EPaper display that you have (or the Waveshare driver in the above post by cpu20) but it should give you an idea.

Link to comment
Share on other sites

Hello All,

Thank you for the replies.

Meanwhile, I have been working away at the code I already have, and after many hours I think  I am just about at the point of getting it to work.  I have the advantage of having a 'scope to look at SPI waveforms.  The display works correctly on a RaspberryPi board with the CPP code from Waveshare, and so I can capture known working SPI waveforms to compare with what my plain C code generates.  More to do, but I think I'm nearly there.

I have downloaded the files from "cpu20".  In fact, they look very similar in structure to the code I am working with, so for now I will continue on my present route.  But these new files could still prove very useful.  I will keep you posted on progress.

When I do get it working I will start work on using the  uGFX graphics library.

Thanks again for your help.

 

 

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