Template: 6inch HD e-Paper user manual
Introduction
1448×1072 high definition, 6inch E-Ink raw display, black/white, 16 grayscale. The PCB (HAT version) is designed for Raspberry Pi
Features
- No backlight, keeps displaying last content for a long time even when power down
- Low power consumption, basically power is only required for refreshing
Specification
- Operating voltage: 5V
- Interface: parallel port
- Outline dimension: 138.4mm × 101.8mm × 1.01mm
- Display size: 122.4mm × 90.6mm
- Dot pitch: 0.0845mm × 0.0845mm
- Resolution: 1448 × 1072
- Display color: black, white
- Gray scale: 2-16 (1-4 bit)
- Full refresh time: <1s
- Viewing angle: >170°
Working with Windows PC (USB)
- Connect the e-Paper to driver board
- Connect the driver board to PC by USB cable
- Download and run the E-LINK-TCON-DEMO software, you can download the software from #Resouces
- Click connect
- Check "AutoSet" option, click "Open File" to select picture, clock "OK" to confirm.
- Click Display to update the e-Papre
Working with Raspberry Pi (SPI)
- Hardware connection
- You should add the IT8951 Driver HAT on Raspberry Pi, communicating via SPI interface.
- You can also connecting by wires
IT8951 Driver HAT | Raspberry Pi (BCM) | Description' |
5V | 5V | 5V power input |
GND | GND | Ground |
MISO | P9 | MISO Pin of SPI |
MOSI | P10 | MOSI Pin of SPI |
SCK | P11 | SCK Pin of SPI |
CS | P8 | Chip selection of SPI (Low active) |
RST | P17 | Reset pin (Low active) |
HRDY | P24 | Busy stats pin (Low when busy) |
- Set the DIP switch to SPI mode
- Open terminal of Raspberry Pi, and install bcm2835 libraries
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.62.tar.gz tar zxvf bcm2835-1.62.tar.gz cd bcm2835-1.62 ./configure make sudo make check sudo make install
- Enable SPI interface
sudo raspi-config
Choose Interfacing Options ->SPI->Yes
- Download demo codes and compile it
git clone https://github.com/waveshare/IT8951-ePaper.git cd IT8951-ePaper make
- Check the VCOM data accodirng to the FPC of the e-Paper
- Run the demo codes, the VCOM should be added
sudo ./epd -2.51
Working with STM32 (SPI or I80)
- Choose interface
- We recommend you to use SPI interface, the pins of SPI interface are less and easy to use
- If the speed of SPI interface is slow for you, you can choose I80 interface which is fast, however, too much pins
- Choose MCU
- Because IT8951 requires a big RAM for data, some of the STM32 boards don't have enought RAM without external SDRAM. Here we use Waveshare Open429I which has IS42S16499J (64-MBIT) SDAM on board.
SPI interface
IT8951 Driver HAT | STM32 | Description' |
5V | 5V | 5V power input |
GND | GND | Ground |
MISO | PE13 | MISO Pin of SPI |
MOSI | PE14 | MOSI Pin of SPI |
SCK | PE12 | SCK Pin of SPI |
CS | PE11 | Chip selection of SPI (Low active) |
RST | PC5 | Reset pin (Low active) |
HRDY | PA7 | Busy stats pin (Low when busy) |
- Set the switch to SPI mode
- Download demo codes from #Resources
- Unzip the deo codes and open the project by Keil. The path o the code is Open429I-C-6-IT8951-Demo\Project\6-IT8951\MDK-ARM\Project.uvproj.
- Compile project, modify IT8951.h file, enable SPI interface, then compile again and progam it to STM32 board
I80 interface
- Connect e-Paper
IT8951 Driver HAT | STM32 | Description' |
DBUS0~DBUS15 | PB0~PB15 | Data pins |
HWE | PC1 | Write enable (Low active) |
D/C | PC7 | Data/Command(Low for command) |
CSEL | PC6 | Chip select enable (Low active) |
HRD | PC3 | Read enable (Low active) |
RST | PC0 | Reset pin (Low active) |
PA7 | Busy stats pin (Low when busy) | |
GND | GND | Ground |
VCC | 5V | 5V power input |
- Set the switch to I80
|}
- You can check the debug information via UART interface
=Make image arrays
For easily porting and using, we didn't use file system in the STM32 code. The image showed is saved as arrays. Here show you how to make the image arrays.
- You should firstly make an BMP file, the resolution of the e-Paper is 1448*1072, you had better resize your picture accoridng to the resolution (less or equal to)
- Click File->Save As...-> Choose type "C" butmap file(*.c) -> input the file name and save
- Select 8 bit per pixel and OK to get the .c file
- Add the .c file to project and delect unuse information
/********************************************************************* * SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * * www.segger.com * ********************************************************************** * * * C-file generated by * * * * Bitmap Converter for emWin V5.22. * * Compiled Jul 4 2013, 12:18:24 * * (c) 1998 - 2013 Segger Microcontroller GmbH && Co. KG * * * ********************************************************************** * * * Source file: zoo_800_600 * * Dimensions: 800 * 600 * * NumColors: 256 * * * ********************************************************************** */ #include <stdlib.h> #include "GUI.h" #ifndef GUI_CONST_STORAGE #define GUI_CONST_STORAGE const #endif extern GUI_CONST_STORAGE GUI_BITMAP bmzoo_800_600; /********************************************************************* * * Palette * * Description * The following are the entries of the palette table. * The entries are stored as a 32-bit values of which 24 bits are * actually used according to the following bit mask: 0xBBGGRR * * The lower 8 bits represent the Red component. * The middle 8 bits represent the Green component. * The highest 8 bits represent the Blue component. */ static GUI_CONST_STORAGE GUI_COLOR _Colorszoo_800_600[] = { 0x000000, 0x010101, 0x020202, 0x030303, 0x040404, 0x050505, 0x060606, 0x070707, 0x080808, 0x090909, 0x0A0A0A, 0x0B0B0B, 0x0C0C0C, 0x0D0D0D, 0x0E0E0E, 0x0F0F0F, 0x101010, 0x111111, 0x121212, 0x131313, 0x141414, 0x151515, 0x161616, 0x171717, 0x181818, 0x191919, 0x1A1A1A, 0x1B1B1B, 0x1C1C1C, 0x1D1D1D, 0x1E1E1E, 0x1F1F1F, 0x202020, 0x212121, 0x222222, 0x232323, 0x242424, 0x252525, 0x262626, 0x272727, 0x282828, 0x292929, 0x2A2A2A, 0x2B2B2B, 0x2C2C2C, 0x2D2D2D, 0x2E2E2E, 0x2F2F2F, 0x303030, 0x313131, 0x323232, 0x333333, 0x343434, 0x353535, 0x363636, 0x373737, 0x383838, 0x393939, 0x3A3A3A, 0x3B3B3B, 0x3C3C3C, 0x3D3D3D, 0x3E3E3E, 0x3F3F3F, 0x404040, 0x414141, 0x424242, 0x434343, 0x444444, 0x454545, 0x464646, 0x474747, 0x484848, 0x494949, 0x4A4A4A, 0x4B4B4B, 0x4C4C4C, 0x4D4D4D, 0x4E4E4E, 0x4F4F4F, 0x505050, 0x515151, 0x525252, 0x535353, 0x545454, 0x555555, 0x565656, 0x575757, 0x585858, 0x595959, 0x5A5A5A, 0x5B5B5B, 0x5C5C5C, 0x5D5D5D, 0x5E5E5E, 0x5F5F5F, 0x606060, 0x616161, 0x626262, 0x636363, 0x646464, 0x656565, 0x666666, 0x676767, 0x686868, 0x696969, 0x6A6A6A, 0x6B6B6B, 0x6C6C6C, 0x6D6D6D, 0x6E6E6E, 0x6F6F6F, 0x707070, 0x717171, 0x727272, 0x737373, 0x747474, 0x757575, 0x767676, 0x777777, 0x787878, 0x797979, 0x7A7A7A, 0x7B7B7B, 0x7C7C7C, 0x7D7D7D, 0x7E7E7E, 0x7F7F7F, 0x808080, 0x818181, 0x828282, 0x838383, 0x848484, 0x858585, 0x868686, 0x878787, 0x888888, 0x898989, 0x8A8A8A, 0x8B8B8B, 0x8C8C8C, 0x8D8D8D, 0x8E8E8E, 0x8F8F8F, 0x909090, 0x919191, 0x929292, 0x939393, 0x949494, 0x959595, 0x969696, 0x979797, 0x989898, 0x999999, 0x9A9A9A, 0x9B9B9B, 0x9C9C9C, 0x9D9D9D, 0x9E9E9E, 0x9F9F9F, 0xA0A0A0, 0xA1A1A1, 0xA2A2A2, 0xA3A3A3, 0xA4A4A4, 0xA5A5A5, 0xA6A6A6, 0xA7A7A7, 0xA8A8A8, 0xA9A9A9, 0xAAAAAA, 0xABABAB, 0xACACAC, 0xADADAD, 0xAEAEAE, 0xAFAFAF, 0xB0B0B0, 0xB1B1B1, 0xB2B2B2, 0xB3B3B3, 0xB4B4B4, 0xB5B5B5, 0xB6B6B6, 0xB7B7B7, 0xB8B8B8, 0xB9B9B9, 0xBABABA, 0xBBBBBB, 0xBCBCBC, 0xBDBDBD, 0xBEBEBE, 0xBFBFBF, 0xC0C0C0, 0xC1C1C1, 0xC2C2C2, 0xC3C3C3, 0xC4C4C4, 0xC5C5C5, 0xC6C6C6, 0xC7C7C7, 0xC8C8C8, 0xC9C9C9, 0xCACACA, 0xCBCBCB, 0xCCCCCC, 0xCDCDCD, 0xCECECE, 0xCFCFCF, 0xD0D0D0, 0xD1D1D1, 0xD2D2D2, 0xD3D3D3, 0xD4D4D4, 0xD5D5D5, 0xD6D6D6, 0xD7D7D7, 0xD8D8D8, 0xD9D9D9, 0xDADADA, 0xDBDBDB, 0xDCDCDC, 0xDDDDDD, 0xDEDEDE, 0xDFDFDF, 0xE0E0E0, 0xE1E1E1, 0xE2E2E2, 0xE3E3E3, 0xE4E4E4, 0xE5E5E5, 0xE6E6E6, 0xE7E7E7, 0xE8E8E8, 0xE9E9E9, 0xEAEAEA, 0xEBEBEB, 0xECECEC, 0xEDEDED, 0xEEEEEE, 0xEFEFEF, 0xF0F0F0, 0xF1F1F1, 0xF2F2F2, 0xF3F3F3, 0xF4F4F4, 0xF5F5F5, 0xF6F6F6, 0xF7F7F7, 0xF8F8F8, 0xF9F9F9, 0xFAFAFA, 0xFBFBFB, 0xFCFCFC, 0xFDFDFD, 0xFEFEFE, 0xFFFFFF }; static GUI_CONST_STORAGE GUI_LOGPALETTE _Palzoo_800_600 = { 256, // Number of entries 0, // No transparency &_Colorszoo_800_600[0] }; GUI_CONST_STORAGE GUI_BITMAP bmzoo_800_600 = { 800, // xSize 600, // ySize 800, // BytesPerLine 8, // BitsPerPixel _aczoo_800_600, // Pointer to picture data (indices) &_Palzoo_800_600 // Pointer to palette };
- Modify codes
static GUI_CONST_STORAGE unsigned char _aczoo_800_600[] = {
- to (you can rename the array)
const unsigned char zoo_800_600[] = {
- Modify IT8951.c file, for example:
extern const unsigned char zoo_800_600[]; void IT8951DisplayExample3() { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; TWord width = gstI80DevInfo.usPanelW; TWord high = gstI80DevInfo.usPanelH; TDWord i; for (i = 0;i < width*high;i++) { gpFrameBuf[i] = zoo_800_600[i]; } IT8951WaitForDisplayReady(); //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord)gpFrameBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = 0; stAreaImgInfo.usY = 0; stAreaImgInfo.usWidth = width; stAreaImgInfo.usHeight = high; IT8951HostAreaPackedPixelWrite(&stLdImgInfo, &stAreaImgInfo);//Display function 2 IT8951DisplayArea(0,0, gstI80DevInfo.usPanelW, gstI80DevInfo.usPanelH, 2); }
Note
Connection=
Because of updating, the hardware connection of e-Paper may difference as the picture showed, please connect the e-Paper according to the screen silk printing.
- Example 1
- Example 2
DIP switch
- We recommend you to use USB, I80 and SPI interfaces
- Whether you use USB, SPI or I80 interface, you should turn the switch to ON as below
- If E-LINK software didn't recognize the e-Paper when you use USB interface, please check if the pins marked in red are accessible.
Codes description
- DisplayColorPaletteExample
- This function is used to display 16 gray bars in order
- This function use 4bp mode and GC16 mode, partial refresh
- DisplayCharacterPatternExample
- This is function is used to draw points, lines, circles, rectangles, and characters. 1bpp method is used with A2 mode.
- DisplayBMPExample
- This function is used to display BMP picture
- DynamicRefreshExample
- This function is used for A2 mode
- This function show you how to update e-Paper in A2 mode. With this demo, e-Paper is updated several times and cleared in INIT mode to clear ghosts.
- DynamicGIFExample
- This function is used to display GIF image.
- The GIF image are divided into seven BMP image and saved to buffer of IT8951. e-Paper will read the BMP files in order and update. Because the images are saved to IT8951 directly, the updated rate, in this case, is the maximum one that the e-paper could reach.
- CheckFrameRateExample
- This function is used to test the update rate of different modes.
About the modes
Mode | Features | 6inch/6inch HD!7.8inch/9.7inch/10.3inch | |
---|---|---|---|
INIT | Used to clear screen. please use it to clear screen after A2 mode | Mode0 | Mode0 |
GC16 | It is used it update screen for 16 grayscale display | Mode2 | Mode2 |
A2 | Can only supports Black and White color | Mode4 | Mode6 |
//basic mode definition UBYTE INIT_Mode = 0; UBYTE GC16_Mode = 2; //A2_Mode's value is not fixed, is decide by firmware's LUT UBYTE A2_Mode = 6; if( strcmp(LUT_Version, "M641") == 0 ){ //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) A2_Mode = 4; Four_Byte_Align = true; }else if( strcmp(LUT_Version, "M841") == 0 ){ //9.7inch e-Paper HAT(1200,825) A2_Mode = 6; }else if( strcmp(LUT_Version, "M841_TFA2812") == 0 ){ //7.8inch e-Paper HAT(1872,1404) A2_Mode = 6; }else if( strcmp(LUT_Version, "M841_TFA5210") == 0 ){ //10.3inch e-Paper HAT(1872,1404) A2_Mode = 6; }else{ //default set to 6 as A2 Mode A2_Mode = 6; }
About bpp
bpp is Bits per pixel, it is the data that show the number of bits per pixel. Currently, all the gray e-Paper supports 1bpp, 2bpp, 4bpp and 8bpp.
- 1bpp
- Evey pixel use 1 bit
- It supports 2 (2^1=2) gray, it is used for A2 mode
- Evey byte contains 8 pixels
- Save in RAM in big-endian format
- IT8951 use little-endian format by default, you should convert it when using.
- 2bpp
- Every pixel use 2 bits
- Support 4(2^2=4) grays
- Every byte contains 4 pixels
- Save in RAM in big-endian format
- IT8951 use little-endian format by default, you should convert it when using.
- 4bpp
- Every pixel use 4 bits
- Support 16(2^4=16) grays
- Every byte contains 2 pixels
- Save in RAM in big-endian format
- IT8951 use little-endian format by default, you should convert it when using.
- 8bpp
- Every pixel use 8 bits
- Support 256(2^8=256) grays, however, IT8951 only use the high four bits, only support 16 grays.
- Every byte contains 1 pixels
- Save in RAM in big-endian format
- IT8951 use little-endian format by default, you should convert it when using.
Every pixel of the original image contains 8bits (1 byte). To convert it to BMP, you can only get the hight bits. For example, if you want to get pixels for 2bpp, you can just get the hight 2 bits from 8bpp(8bits) image.
UDOUBLE Addr = X * (Paint.BitsPerPixel) / 8 + Y * Paint.WidthByte; switch( Paint.BitsPerPixel ){ case 8:{ Paint.Image[Addr] = Color & 0xF0; break; } case 4:{ Paint.Image[Addr] &= ~( (0xF0) >> (7 - (X*4+3)%8 ) ); Paint.Image[Addr] |= (Color & 0xF0) >> (7 - (X*4+3)%8 ); break; } case 2:{ Paint.Image[Addr] &= ~( (0xC0) >> (7 - (X*2+1)%8 ) ); Paint.Image[Addr] |= (Color & 0xC0) >> (7 - (X*2+1)%8 ); break; } case 1:{ Paint.Image[Addr] &= ~( (0x80) >> (7 - X%8) ); Paint.Image[Addr] |= (Color & 0x80) >> (7 - X%8); break; } }
Align bytes
During test, we find that when we use 1bpp mode to update the 6inch e-Paper, 6inch HD e-Paper, we should align the X (begin point) and W (width) of udpate area to four bytes (32bits), otherwse, the image cannot be displayed.
if( strcmp(LUT_Version, "M641") == 0 ){ //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) A2_Mode = 4; Four_Byte_Align = true; }else if( strcmp(LUT_Version, "M841") == 0 ){ ... } if(Four_Byte_Align == true){ In_4bp_Refresh_Area_Width = Panel_Width - (Panel_Width % 32); }else{ In_4bp_Refresh_Area_Width = Panel_Width; } X_Start = Min_X < 32 ? 0 : Min_X - (Min_X % 32); Debug("X_Start:%d\r\n",X_Start); X_End = ( Max_X + (32 - (Max_X % 32)) ) > Touch_Pannel_Area_Width ? ( Max_X - (Max_X % 32) ) : ( Max_X + (32 - (Max_X % 32)) ); Debug("X_End:%d\r\n",X_End); Y_Start = Min_Y; Debug("Y_Start:%d\r\n",Y_Start); Y_End = Max_Y; Debug("Y_Start:%d\r\n",Y_End); Width = X_End - X_Start; if(Width<=0){ Width = 32; } Debug("Width:%d\r\n",Width); Height = Y_End-Y_Start; if(Height<=0){ Height = 32; } Debug("Height:%d\r\n",Height);
About the speed of SPI
The CPU of Raspberry Pi 3 is different with Raspberry Pi 4
- For Raspberry Pi, it could use maximum 16 clock divider
- For Raspberry Pi, it could use maximum 32 clock divider
- You can refer to the description of BCM2835 libraries about the clock divider
- You can modify the clock divider according to the board you use
bcm2835_spi_begin();//Start spi interface, set spi pin for the reuse function bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST);//High first transmission bcm2835_spi_setDataMode(BCM2835_SPI_MODE0);//spi mode 0 //bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_16);//For RPi 3/3B/3B+ bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_32);//For RPi 4B /* SPI clock reference link:*/ /*http://www.airspayce.com/mikem/bcm2835/group__constants.html#gaf2e0ca069b8caef24602a02e8a00884e*/
Enhance driving capability
Sometimes, the e-Paper display abnormally because of long FPC cable, in this case, you can try to enhance the driving capability
#if(Enhance) Debug("Attention! Enhanced driving ability, only used when the screen is blurred\r\n"); Enhance_Driving_Capability(); #endif /****************************************************************************** function : Enhanced driving capability parameter: Enhanced driving capability for IT8951, in case the blurred display effect ******************************************************************************/ void Enhance_Driving_Capability(void) { UWORD RegValue = EPD_IT8951_ReadReg(0x0038); Debug("The reg value before writing is %x\r\n", RegValue); EPD_IT8951_WriteReg(0x0038, 0x0602); RegValue = EPD_IT8951_ReadReg(0x0038); Debug("The reg value after writing is %x\r\n", RegValue); }
- If you are using the USB interafce with PC, you can try to configure:
About VCOM
The VCOM voltages of every e-Paper panel are different and they are printed on FPC cable. Please make sure that you use the correct VCOM.