Skip navigation
Home > All Places > WICED Studio Bluetooth > WICED Studio Bluetooth Forums > Blog > 2018 > July

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.



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 Defenition


Pin Configuration on 20719


Display Reset Pin

P0 (D2)

Output pin


Display Busy Pin

P33 (D1)

Input pin


Display Enable Pin

P34 (D0)

Output pin


Discharge Pin

P26 (D5)

Output pin


Border Control Pin

P2 (D6)

Output pin


Display IO Enable Pin

P4 (D7)

Output pin


Eink Select Pin

P7 (D10)

SPI CS pin



P28 (D11)




P1 (D12)




P38 (D13)








  1. 3.3V





IO Ref


Pin Significance:

  1. Display Reset Pin: Reset signal for display. This pin need to pull high and low as defined in the E-INK display driver document.
  2. 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.
  3. 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.
  4. Display Enable Pin – To control the display On /OFF
  5. 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.
  6. 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.
  7. SPI interface pins: Uses SPI MOSI, MISO, SCLK and software controlled CS pins for the SPI communication between display and CYW20719



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 

(Path: /20719-B1_Bluetooth/platforms/CYW920719Q40EVB_01/wiced_platform_pin_config.c)

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.



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:

  1. Store new pattern in the memory buffer
  2. Power on the display driver
  3. Initialize the display driver
  4. Update the display stage by stage
  5. 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

  1. First step is to make an initial screen as shown above with pixel format 246 x 176
  2. Convert the image to 5808 bytes’ frame buffer using the GUI given in Appendix B
  3. Display the initial screen by the steps mentioned in section 4.1
  4. The sensor data is passing as text for time, battery, temperature, pressure etc.
  5. Find the co-ordinates to display the sensor data mentioned in step 4 by using Cy_EINK_TextToFrameBuffer() API by trial and error method.
  6. 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.


Note: Attached the Appendix as well as demo project file.

This blog post discusses implementation of BLE Proximity Profile in CYW20719 and CYW20735 using the Bluetooth Designer tool of WICED Studio SDK.


Tool: WICED studio 6.2, Serial Terminal (Example: TeraTerm, CoolTerm)

Programming Language: C

Associated Parts: CYW20719 / CYW20735

Related Hardware: CYW920719Q40EVB_01 Board (1 or 2) / CYW920735Q60EVB_01 (1 or 2)

Proximity Profile:

The purpose of proximity profile is to keep an eye on the BLE Connection link between two devices and trigger an alert when the link is weakened as path loss increases. This profile supports two roles:

  1. Proximity Server (Reporter)
  2. Proximity Client (Monitor)

The proximity profile must include the Link Loss Service. It may optionally include Tx Power Service and Immediate alert service also. Link Loss Service:  The GATT DB of the link loss service has the “Alert Level” characteristic which may be written by the proximity client. This indicates the level of alert to be triggered in the server when the disconnection happens.Tx power Service:  The proximity client may anytime know the Transmitter Power level of the server. This is enabled by reading the Tx Power level characteristic included in the Tx power service.Immediate Alert Service:  The proximity monitor may keep calculating the path loss as follows:


Path Loss = Tx Power Level – RSSI


If the path loss exceeds a certain threshold, the monitor may write the Alert Level characteristic of the IAS, thereby prompting the user to perform appropriate action to avoid disconnection.

Block Diagram:

Using the Bluetooth Designer to generate Proximity Server project:

We can use the Bluetooth Designer in WICED Studio SDK to generate the GATT DB and an outline code for the firmware. For more details on using the Bluetooth Designer, refer to the Bluetooth Designer Guide in WICED Studio SDK. The GATT DB of the Proximity Server has 3 different services. It is easy to generate the GATT DB and a skeleton code using the Bluetooth Designer Tool. (For more details on the Bluetooth Designer tool, please refer the user guide which can be accessed in the WICED Studio from Project Explorer -> <Platform> -> Doc

  1. In the WICED Studio SDK, go to File -> New -> WICED Bluetooth Designer. Enter the device name as “ProximityServer”, mode as Single Mode LE.
  2. Check the GATT DB enabled option Click Next.
  3. Using the “Add Service” Option, different services are selected.
  4. Add the characteristics as shown above and click “Generate Code” to obtain the skeleton project.

Firmware:This example contains two projects – The proximity server and the proximity client. Proximity Server:  A skeleton code of the proximity server can be generated using the above steps. Certain key features need to be added to the skeleton code to make the server project complete. According to the specification, a proximity reporter has to advertise with the UUID of Link Loss Service. So, the advertisement data should be modified as follows


:/* Set Advertisement Data */

void proximityserver_set_advertisement_data( void )

{    wiced_bt_ble_advert_elem_t adv_elem[3] = { 0 };


    uint8_t num_elem = 0;
    /* Advertisement Element for Flags */ 

    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_FLAG;

    adv_elem[num_elem].len = sizeof(uint8_t);

    adv_elem[num_elem].p_data = &adv_flag;


    adv_elem[num_elem].advert_type  = BTM_BLE_ADVERT_TYPE_16SRV_COMPLETE;

   adv_elem[num_elem].len          = sizeof(lls_uuid);

   adv_elem[num_elem].p_data       = ( uint8_t* )lls_uuid;


    /* Advertisement Element for Name */

   adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE;

    adv_elem[num_elem].len = strlen((const char*)BT_LOCAL_NAME);

    adv_elem[num_elem].p_data = BT_LOCAL_NAME;


    /* Set Raw Advertisement Data */

    wiced_bt_ble_set_raw_advertisement_data(num_elem, adv_elem);


Where lls_uuid is declared and initialized as:

/* Link Loss service UUID  */

const uint8_t lls_uuid[2] = {(uint8_t)UUID_SERVICE_LINK_LOSS & 0xFF, (uint8_t)(UUID_SERVICE_LINK_LOSS >> 8)  };

The proximity server receives Link Loss and IAS Alerts in the form of writes.. The IAS Alert is triggered instantaneously where as the link loss alert happens when there is a disconnection. The Alerts are indicated by the LEDs.Proximity Client:  This is a central / client device that performs read / write operations with the GATT DB of the server. The central starts scanning for peripherals that advertise with a Link Loss Service UUID, upon a GPIO button press and initiates the connection. Then it begins to discover all the three services of the proximity profile in the server, one by one and saves the handles of the attributes. Following this, the TX power characteristic of the server is read. Now the client periodically calculates the RSSI every 100 mS and thus the average path loss. If the path loss reaches beyond certain thresholds, the client writes to the Immediate alert characteristics of the server, resulting in an immediate trigger. The thresholds are as follows:MILD ALERT: Path loss above 90 dB HIGH ALERT: Path loss above 100 dBThe Link loss alert can be written to the server by pressing the GPIO Interrupts on the client Eval Board. Everytime the GPIO is pressed, a different LL alert value is written to the server. 

Programming and Testing:


  1. Install the WICED Studio 6.2 (or above) in your PC. Plug in two CYW920719Q40EVB_01 Boards and let the drivers bind
  2. to the devices. Make sure the jumpers are in place. Open WICED Studio and set the platform as 20719-B1_Bluetooth. For more details, please refer CYW920719Q40EVB_01-Kit-Guide.pdf present in Doc folder in the project explorer.
  3. Copy the ProximityServer and the ProximityClient folders. In the WICED Studio, right-click the Apps folder in the Project Explorer pane and click Paste. You can see these folders under the Apps folder.
  4. Open two windows of Serial Terminal (Example: Teraterm or Coolterm), and bind each of those windows to the PUART COM Ports of each devices. Each device has two COM Ports with consecutive numbers. The COM Port with the bigger number corresponds to the PUART that displays Debug Messages. The one with the smaller number corresponds to the HCI UART. The BaudRate is set to 115200 in the firmware. Make sure the BaudRate in serial terminals is also set to 115200.
  5. Create a Make Target for the project by selecting Project -> Make Target -> Create. Paste the following as the entry in the Target Name field:

ProximityServer-CYW920719Q40EVB_01 UART=COMxx download

Make sure that the Same as the Target Name checkbox is checked. Click OK. Create another target, in addition to the previous one as:

ProximityClient-CYW920719Q40EVB_01 UART=COMyy download

(Note: In the above targets, XX and YY are the PUART COM Port numbers of each of the devices)

    6. Double click the ProximityServer Target you just created, shown in the Make Target Pane on the right. You can see the Secure_hub program being built and downloaded into one of the boards.

     7.  Similarly program the ProximityClient program to the device.

     8. The ProximityServer device will start to advertise. In the ProximityClient device, press the BTN (D2) button for more than 5 seconds for the scan to start. Once the ProximityClient finds the           ProximityServer device advertising, it will automatically initiate connection and pairing process.

     9. The client performs discovery in the server and saves the attribute handles of the Link loss alert, immediate alert and transmit power characteristics. The initial Tx power is also read from the server.

     10. Click the BTN (D2) button to write LL Alert value to the server. Everytime the button is pressed, a different value of alert level (among the 3: NO_ALERT, MILD_ALERT, HIGH_ALERT) is written to the server. When a link loss happens the server will be triggered based on the alert level that was written, as indicated by the LED 2.

     11. The client will also keep calculating the Path loss and writes immediate alerts to the server if the path loss value exceeds a certain threshold. Such alerts immediately trigger the server, as indicated by the LED 1.

Path Loss Vs Distance:


For a Tx Power of 4 dBm in CYW20719 and of 12 dBm in CYW20735, the path loss Vs Distance values are observed as below in an office environment.






Distance (m)

Path Loss (dBm)













































Related Documents:

The below table lists all relevant application notes, code examples, knowledge base articles, device datasheets, and Component / user module datasheets.






CYW920719Q40EVB-01 Evaluation Board User Guide

The  User Guide can be accessed in the WICED Studio from Project Explorer -> 20719-B1_Bluetooth -> Doc


Developing Custom Applications with BT Designer - Document

This document can be accessed from Project Explorer -> <Platform> -> Doc

Filter Blog

By date:
By tag: