E-ink Display interface with CYW20719
E-INK (electronic ink) is a paper-like display technology, characterized by high contrast, wide viewing angles, and minimal standby power. Unlike conventional backlit, flat panel displays that emit light, E-INK displays reflect light like paper. This makes E-INK displays more comfortable to read, and provides a wider viewing angle than most light-emitting displays. Therefore, E-INK displays are comfortable to read even in sunlight.
Currently we are using CY8CKIT-028-EPD E-INK Display Shield (EPD) interfaced with CYW20719 Eval board. The E-INK Shield has a 2.7-inch E-INK display with a resolution of 264×176 pixels.
The E-INK display contains a basic driver IC that interfaces with the CYW20719 using a custom SPI interface. The driver converts a serial data stream into individual pixel data and generates the voltages required for the E-INK display. Thus, CYW20719 has low level control to the display through the driver IC.
See the E-INK display driver document for more details.
2. HARDWARE SETUP
The CYW20719 controls the E-INK display’s reset, enable, discharge and border pins. The controller check the busy status of display via Busy pin of E-ink display. The table below shows the pin to pin connection between CY8CKIT-028-EPD E-INK Display Shield and CYW20719 Eval board.
Table 1: Pin connections
E-ink Display Shield Pins
Pin Configuration on 20719
Display Reset Pin
Display Busy Pin
Display Enable Pin
Border Control Pin
Display IO Enable Pin
Eink Select Pin
SPI CS pin
SPI MOSI Pin
SPI MISO Pin
- Display Reset Pin: Reset signal for display. This pin need to pull high and low as defined in the E-INK display driver document.
- Display Busy Pin: It’s an input pin for CYW20719. When busy pin is high, EPD stays in busy state and EPD ignores any input data from SPI.
- Discharge Pin: Used to discharge the excess voltage in charge pump capacitors during EPD power off. This pin must be set high for EPD discharge when EPD power off.
- Display Enable Pin – To control the display On /OFF
- Display IO Enable Pin – To control the voltage translator IC between the WICED and display. This pin is specific for CY8CKIT-028-EPD E-INK Display Shield.
- Border Control Pin: Around the active area of EPD there is a 0.5mm width blank area called Border. After EPD updates with the constant voltage, the border color may degrade to a gray level that is not as white as the active area. To avoid this phenomenon, we should reset the Border per screen update. All these are taken care in the driver code.
- SPI interface pins: Uses SPI MOSI, MISO, SCLK and software controlled CS pins for the SPI communication between display and CYW20719
3. E-INK DISPLAY SPI CONFIGURATION
The CYW20719 uses SPI communication with the driver IC of E-Ink display with a SPI speed maximum upto 24MHz. This E-ink display driver needs a software controlled chip select pin. Thus, make sure you have disabled the hardware SPI CS pin of CYW20719. For that, change the pin configuration of default CS (Chip select) pin (P07) to WICED_GPIO in the wiced_platform_pin_config.c file
The SPI format for display driver differs from the standard. Thus the E-ink driver code is written in such a way that follows the SPI command and timing described in the E-INK display driver document.
4. FIRMWARE FLOW OF DISPLAY
The E-Ink Display driver library provides the user low level APIs to use in their end application code. The various driver APIs are provided in the Appendix A. The driver API definitions are written as per the work flow defined in the E-INK display driver document. As an end user, you need not have to worry about the driver code, rather you must be familiarized with the end level driver APIs defined in Appendix A.
The display driver updates the display with respect to the current frame and previous frame written from the CYW20719 controller to the driver via SPI communication. One frame buffer contains 5808 ((246x176)/8) bytes. For converting the image into 5808 bytes’ frame buffer, you can use the GUI given by display vendor (Given in Appendix B). Check Appendix B for image and text formats supported by this E-ink display.
The procedure to update the display is:
- Store new pattern in the memory buffer
- Power on the display driver
- Initialize the display driver
- Update the display stage by stage
- Power off the display driver
The driver APIs are taken care of the above steps.
Attached a demo project designed for a sensor hub. The demo uses below custom functions which using low-level display driver APIs:
- Disp_Initialize() for initializing the display
- Display_Initial_Screen() for displaying a initial screen
- RefreshDisplay() for refreshing the screen with sensor value.
4.1 Display Initial Screen
Figure below shows the flow of code for displaying an initial screen on the E-ink display. First power on the E-ink by sending start commands, which is already taken care in the E-ink library API. Disp_Initialize function will initialize the display functions and create the frame buffer from the image buffer created by GUI given in Appendix B. After that clear the display with a white background by calling Cy_EINK_ShowFrame function. Cy_EINK_ShowFrame function will display the image corresponding to current frame buffer. You must call Cy_EINK_ImageToFrameBuffer() function by passing the pointer for image to displayed before calling Cy_EINK_ShowFrame function. Refer Appendix A for function descriptions.
4.2 Refresh Display
The display need to be updated by the sensor values collected. We have hard coded co-ordinates for displaying each sensor values. The RefreshDisplay function will take the sensor values, convert it to hex values and will update the main frame buffer at specific co-ordinates hard coded in the function. Cy_EINK_TextToFrameBuffer function will convert the sensor values to corresponding bytes which will be embedded into the main frame buffer. This main buffer will be passed to the Cy_EINK_ShowFrame function for displaying the screen with sensor values.
5. EH Kit Display Screen details:
Steps involved in the display configuration
- First step is to make an initial screen as shown above with pixel format 246 x 176
- Convert the image to 5808 bytes’ frame buffer using the GUI given in Appendix B
- Display the initial screen by the steps mentioned in section 4.1
- The sensor data is passing as text for time, battery, temperature, pressure etc.
- Find the co-ordinates to display the sensor data mentioned in step 4 by using Cy_EINK_TextToFrameBuffer() API by trial and error method.
- Once you fix the co-ordinates in step 5, hardcode the co-ordinates in function RefreshDisplay() and update only the values in that co-ordinates in timely basis.