Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP: IL3829 e-Paper/e-Ink display driver #11078

Closed
wants to merge 5 commits into from
Closed

Conversation

silkeh
Copy link
Contributor

@silkeh silkeh commented Feb 28, 2019

Contribution description

This PR adds a driver for the IL3829 e-Paper display driver.
This driver is commonly used in 1.54 inch black and white e-Paper displays like this one.
The PR is currently WIP because of some things need to be looked up/tested (labelled with TODO in the code).

Highlights:

  • A common SPI display driver. This contains parts I believe to be common to most SPI displays, like the one in ili9341: Initial import of ili9341 LCD driver #9948. Let me know if I should create a separate PR with this (and if it's a good idea at all).

  • IL3829 display driver. This still needs some testing, because the module I currently own does not have the busy or reset pin available (this one is on the way, though).

  • Header files containing RIOT logos. These were generated using png2c.
    Some questions:

    • Should I move these to a generally available directory?
    • What should the copyright notice be?
  • Tests for the display driver. A video with the full test can be found here.

  • The API of this driver is similar to the one from ili9341: Initial import of ili9341 LCD driver #9948. The major difference is that the x2, y2 arguments are the coordinate of the corner, not the pixel in the corner. See this discussion.

Testing procedure

A test program is included (tests/driver_il3829).
Modify the makefile for a microcontroller/display combination you have and go for it.

This test will probably be updated when I have a display with the busy and reset pins (in a few weeks).

Issues/PRs references

none

@bergzand bergzand requested a review from aabadie February 28, 2019 10:09
@bergzand bergzand added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: drivers Area: Device drivers labels Feb 28, 2019
@jcarrano
Copy link
Contributor

jcarrano commented Mar 4, 2019

We have a board here (PHYTEC's reel board, see #11096 ) that uses the SSD1673. Looking at the datasheet, they are so similar that it is almost the same chip. They even seem to have the same command.

I could try it here, but first take a look at the SSD1673 just in case, I would not want the only reel we have here to catch fire (and even less @haukepetersen)

@haukepetersen
Copy link
Contributor

Just a thought: did you consider to also port the driver to the u8g2 library? It is working as a package for RIOT and provides many useful things when working with a display...

@jcarrano
Copy link
Contributor

jcarrano commented Mar 4, 2019

Mmmm, looking at u8g8, there was an attempt at adding it. It seems u8g2 is not really suited for E-paper (at least according to its author.) However....

... There is this library called GxEPD, that seems to support this chip. It could be added to RIOT package collection. It does not seem to have any documentation, so I wonder how people manage to use it.

EDIT: oops, github misled me. It said the code was mostly C but looking closer it's C++.

@aabadie
Copy link
Contributor

aabadie commented Mar 5, 2019

@silkeh, do think this PR could be compatible with the display that is on the board provided by #9517 ?

@silkeh
Copy link
Contributor Author

silkeh commented Mar 5, 2019

We have a board here (PHYTEC's reel board, see #11096 ) that uses the SSD1673. Looking at the datasheet, they are so similar that it is almost the same chip. They even seem to have the same command.

It's close, but not compatible: all commands for the Y counters/area are a single byte instead of two. This is because the SSD1673 is a 150x250 controller, and the IL3829 200x300.

From the datasheet it also looks like the waveform lookup table (LUT) should be different, but the implementation for the Zephyr project has definitions that match the ones in this driver.

Looking at some other implementations there seem to be some different LUTs floating around, so there is something to say for making this configurable. I'm not entirely sure how much that matters, but I will investigate once I have received the second display.

Also: the SSD1607 does seem to be identical, and there are probably others.

Just a thought: did you consider to also port the driver to the u8g2 library? It is working as a package for RIOT and provides many useful things when working with a display...

No, but if I have some time I can take a look. As noted by @jcarrano, is seems e-paper is not the main target for the library. It does have some support (according to the reference), but lacks partial updates.

@silkeh, do think this PR could be compatible with the display that is on the board provided by #9517 ?

The display seems to have a SSD1606, which also uses a single byte for the Y values. Additionally, the size of the LUT for this display is 90 bytes instead of 30. At first glance it looks to be pretty much identical otherwise.

At this point it looks like it may be a good idea to start reworking this to support generic monochrome e-paper displays.

@talalong
Copy link

talalong commented May 30, 2019

Hi, I tried to test your driver using samr21-xpro and e-paper 4.2 (waveshare).
I did make changes in the Makefile, but something is not right there (code below).
GPIO_PIN\(0,14\) means GPIO_PIN\(PA,14\) and GPIO_PIN\(1,2\) means GPIO_PIN\(PB,14\)

BOARD := samr21-xpro #nucleo-f411re
USEMODULE += xtimer
USEMODULE += spi_epaper
CFLAGS += -DDISPLAY_X=300#200
CFLAGS += -DDISPLAY_Y=400#200
CFLAGS += -DSPI_EPAPER_CONTROLLER=SPI_EPAPER_CONTROLLER_IL3829 # ?
CFLAGS += -DSPI_EPAPER_PARAM_CS=GPIO_PIN(0,14)
CFLAGS += -DSPI_EPAPER_PARAM_DC=GPIO_PIN(1,2)
CFLAGS += -DSPI_EPAPER_PARAM_RST=GPIO_PIN(0,16)
CFLAGS += -DSPI_EPAPER_PARAM_BUSY=GPIO_PIN(0,8)

-> so I reduced X and Y to 200, but I got anothers errors like:

/home/vagrant/Tutorials/RIOT-Test/RIOT-test-epaper-display-driver/drivers/spi_epaper/spi_epaper.c: In function 'spi_epaper_display_init':
/home/vagrant/Tutorials/RIOT-Test/RIOT-test-epaper-display-driver/drivers/spi_epaper/spi_epaper.c:46:5: error: missing braces around initializer [-Werror=missing-braces]
le_uint16_t y_data[2] = {0};

-> I did some google searches and it might be gcc issue
Update:
my current gcc version on vagrant is 5.4.0, should I update it to the last version 9.1 ?

{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
Copy link
Contributor

@Citrullin Citrullin Jul 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include this in driver? I am not sure. Should be in the example- and test-code, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I like having RIOT logos in RIOT for people to include. This driver is probably not the best place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silkeh But I would make it optional, to save the storage.

ifneq (,$(filter il3829,$(USEMODULE)))
FEATURES_REQUIRED += periph_spi
FEATURES_REQUIRED += periph_gpio
USEMODULE += spi_display
Copy link
Contributor

@Citrullin Citrullin Jul 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call it spi_epd, spi_epaper_display or something similar? spi_display is generic. This could also be an OLED or LCD. What do you think @aabadie ?

Copy link
Contributor Author

@silkeh silkeh Oct 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spi_display was very generic (and pretty useless), I have now reworked it to epd_bw_spi for the specific class of displays. See #12509.

@Citrullin
Copy link
Contributor

Citrullin commented Jul 21, 2019

At this point it looks like it may be a good idea to start reworking this to support generic monochrome e-paper displays.

I would consider to support multi color as well. At least white/black/red or yellow. The generic spi_display is a good approach, I think. As said in another comment, I would rename it.


void il3829_display_init(il3829_t *dev)
{
uint16_t y_data[2] = { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The factory firmware of good-display pulls the RST pin down and up here. I would use this here too. The wake up function would make sense here then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while (1) {
/* Set both RAM buffers to the RIOT logo */
draw_riot(&dev);
draw_riot(&dev);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason to do this two times?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to set all two RAM buffer to the RIOT logo.

void spi_display_wait(spi_display_params_t *p, uint32_t usec)
{
if (p->busy_pin != GPIO_UNDEF) {
while (gpio_read(p->busy_pin)) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this. The IL0373 is active low on BUSY, while the IL3829 is active high.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Citrullin
Copy link
Contributor

@silkeh I work on a driver for the IL0373. I used this PR as a base for it. I need to change the API in some way in order to make it work. You can follow the process here.

@silkeh
Copy link
Contributor Author

silkeh commented Oct 19, 2019

Closed in favour of #12509, which implements a more generic driver.

@silkeh
Copy link
Contributor Author

silkeh commented Oct 19, 2019

At this point it looks like it may be a good idea to start reworking this to support generic monochrome e-paper displays.

I would consider to support multi color as well. At least white/black/red or yellow. The generic spi_display is a good approach, I think. As said in another comment, I would rename it.

There are a lot of differences between these classes of displays. I am willing to work on this, but I need a display (and time) first. Let's make b/w first!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: drivers Area: Device drivers State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants