Auf einem PIC von Microchip habe ich ein Programm laufen, auf dem ich Daten auf dem E-Paper von GooDisplay GDEY029T94 (2,9zoll 296x128px) partiell anzeigen kann, auch nach einer Tiefschlaf-Phase. Ohne das Display jedesmal neu zu initialisieren. Nach einer Neuinitialisierung würde es mehrmals flackern was sehr störend ist.
Das Display ist immer an Spannung und an einem HAT DESPI-C02 angeschlossen.
Nun habe ich ein Display mit höherer Auflösung GDEY029T71H (2,9zoll 384x168px) gekauft .
Mit diesem Display funktioniert der partielle Update nach dem ersten Deep-Sleep nicht mehr.
Auf dem Arduino-UNO habe ich ein kleines Testprogramm. Nach dem 1. Deep-Sleep funktioniert der Partielle Update nicht mehr - Das Programm bleibt bei der Busy-Abfrage hängen (Busy geht nicht auf log. 0). Hat jemand eine Idee wo das Problem liegen könnte?
Hier das Programm:
#include "Display_EPD_W21_spi.h"
#include "Display_EPD_W21.h"
#include "Ap_29demo.h"
void setup() {
#ifdef Arduino_UNO
pinMode(4, INPUT); //BUSY
pinMode(5, OUTPUT); //RES
pinMode(6, OUTPUT); //DC
pinMode(7, OUTPUT); //CS
pinMode(13, OUTPUT); //SCLK
pinMode(11, OUTPUT); //SDIN
#endif
EPD_HW_Init(); //Electronic paper initialization.
EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh.
}
void loop() {
unsigned char i;
//////////////////////Partial refresh time demo/////////////////////////////////////
for(i=0;i<6;i++)
EPD_Dis_Part_Time(64,140+32*0,Num[i], //x-A,y-A,DATA-A
64,140+32*1,Num[0], //x-B,y-B,DATA-B
64,140+32*2,gImage_numdot, //x-C,y-C,DATA-C
64,140+32*3,Num[0], //x-D,y-D,DATA-D
64,140+32*4,Num[1],32,64); //x-E,y-E,DATA-E,Resolution 32*64
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(1000); //Delay for 1s.
for(i=3;i<6;i++)
EPD_Dis_Part_Time(64,140+32*0,Num[i], //x-A,y-A,DATA-A
64,140+32*1,Num[0], //x-B,y-B,DATA-B
64,140+32*2,gImage_numdot, //x-C,y-C,DATA-C
64,140+32*3,Num[0], //x-D,y-D,DATA-D
64,140+32*4,Num[1],32,64); //x-E,y-E,DATA-E,Resolution 32*64
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(1000); //Delay for 1s.
}
void EPD_Part_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0x1C); //1C
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
/*
EPD_W21_WriteCMD(0x21);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x22);
EPD_W21_WriteDATA(0xDC);
EPD_W21_WriteCMD(0x20);
*/
Epaper_READBUSY();
}
//Partial refresh write address and data
void EPD_Dis_Part_RAM(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE)
{
unsigned int i;
unsigned int x_end,y_end;
x_start=x_start/8; //x address start
x_end=x_start+PART_LINE/8-1; //x address end
y_start=y_start-1; //Y address start
y_end=y_start+PART_COLUMN-1; //Y address end
EPD_W21_WriteCMD(0x44); // set RAM x address start/end
EPD_W21_WriteDATA(x_start); //x address start
EPD_W21_WriteDATA(x_end); //y address end
EPD_W21_WriteCMD(0x45); // set RAM y address start/end
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteDATA(y_end%256); //y address end2
EPD_W21_WriteDATA(y_end/256); //y address end1
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(x_start); //x start address
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X127;
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(pgm_read_byte(&datas[i]));
}
}
//Clock display
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
)
{
EPD_Dis_Part_RAM(x_startA,y_startA,datasA,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startB,y_startB,datasB,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startC,y_startC,datasC,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startD,y_startD,datasD,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startE,y_startE,datasE,PART_COLUMN,PART_LINE);
EPD_Part_Update();
}
//Partial refresh of background display, this function is necessary, please do not delete it!!!
void EPD_SetRAMValue_BaseMap( const unsigned char * datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(pgm_read_byte(&datas[i]));
}
EPD_W21_WriteCMD(0x26); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
EPD_Update();
EPD_W21_WriteCMD(0x26); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(pgm_read_byte(&datas[i]));
}
}
void Epaper_READBUSY(void)
{
while(1)
{ //=1 BUSY
if(isEPD_W21_BUSY==0) break;
}
}
#endif
//Full screen refresh initialization
void EPD_HW_Init(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
Epaper_READBUSY();
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY();
EPD_W21_WriteCMD(0x3C); //BorderWavefrom
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x01); //Driver output control
EPD_W21_WriteDATA((EPD_HEIGHT-1)%256);
EPD_W21_WriteDATA((EPD_HEIGHT-1)/256);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x11); //data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44); //set Ram-X address start/end position
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(EPD_WIDTH/8-1);
EPD_W21_WriteCMD(0x45); //set Ram-Y address start/end position
EPD_W21_WriteDATA((EPD_HEIGHT-1)%256);
EPD_W21_WriteDATA((EPD_HEIGHT-1)/256);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); //BorderWavefrom
EPD_W21_WriteDATA(0x05);
EPD_W21_WriteCMD(0x18); //Read built-in temperature sensor
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X199;
EPD_W21_WriteDATA((EPD_HEIGHT-1)%256);
EPD_W21_WriteDATA((EPD_HEIGHT-1)/256);
Epaper_READBUSY();
}