Waveshare 4.3 Inch E-Paper UART Module Contrast Issue

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

            I have recently bougth this E-Paper display module: https://www.waveshare.com/wiki/4.3inch_e-Paper_UART_Module. I have interfaced it with ATMega1284p and got it working correctly except for the contrast part. When I received the display, it was having that image being displayed on advertisement, as it is. It was having perfectly balanced contrast but the moment I refreshed the E-Paper for the first time, that contrast has vanished.

 

           I am getting really low contrast and I am not able to find any solution to this so far. I suspected some flaw in my code so I have tried the demo code provided by manufacturer with Arduino UNO, but the result stays the same. I am driving the microcontroller and display with 5V. I am speculating that the display itself is faulty and trying to get a replacement.

 

           However, at times while refreshing, screen turns quite dark, which I am unable to reproduce for any image, or font, or shape drawn using raw commands only. This makes me think that the screen itself is having capability of displaying everything in high contrast but the processor communicating with it having some kind of fault.

 

           Also, one more strange thing I have noticed is that the color code is inversed for this display. For example, if I draw an image with Part A being Black and Part B being White, then it will be displayed as Part A being White and Part B being Black. If I request the foreground and background color information from module, it turns out to be correct, but displaying is inverse. The same behavior follows for internally drawn shapes too.

 

           Moreoever, as this display is having 4 shades (White, Light Gray, Dark Gray, Black) I thought that it might be the case that the internal codes of those shades got mixed up somehow, so I tried drawing shapes by setting the colors Light Gray and Dark Gray, instead of White and Black but, that worked as it should! The result was having even lighter contrast!! I am monitoring responses from module and they're always perfect - sending ASCII of OK and values that I request.

 

          I have searched a lot on google also regarding this issue (contrast one, as that's making the display unusable) but it seems to me that no one has ever encountered such a problem before. I have watched the videos of users interfacing the same display module with Arduino and getting perfect results with great contrast. And while I am using the 'Same hardware and Same software' I am not getting it! I have posted the images of display below. If anyone has any idea about how to solve this, please help me out. Thank you.

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So have you contacted Waveshare for support?

 

Waveshare wrote:

Contact your seller (fast response and most recommended)

or send emails to service@waveshare.com 

 

https://www.waveshare.com/wiki/4.3inch_e-Paper_UART_Module#Support

 

 

https://www.waveshare.com/contact_us

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

what are you trying to display, Poorn?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Russell ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you show us your sketch (code) and sample command / response your getting from the display?

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ awneil - I have contacted the seller and I was able to convince them for a replacement. As per their technical support team, the module they tried after my complaint with same code worked flawlessly. Anyway my RMA number is generated and I will ship the display within 24 hours. I still have some time left to experiment on it. 

 

@ Kartman - I have tried displaying following: Manufacturer supplied 1bpp BMP image, 2bpp BMP image. Custom converted 1bpp BMP image. A pattern generated using commands described in user manual. A filled circle generated using commands described in user manual. All are having the same problem.

 

@ Jim - Sure. I am posting my ATmega1284p code below. Find the code I have tried in arduino here: https://www.waveshare.com/w/upload/e/eb/4.3inch-e-Paper-Code.7z. I have not changed it even a bit. 

 

 


#include <avr/io.h>
#define F_CPU 11059200UL
#include <util/delay.h>
#include <stdlib.h>
#define ms(ms_time)		_delay_ms(ms_time)
#define us(us_time)		_delay_us(us_time)

typedef uint8_t Byte;
typedef uint16_t Word;
typedef uint32_t DWord;

Word ms_time,us_time;

// LCD Section

#define LCD_DDR		DDRA
#define LCD_PORT	PORTA
#define LCD_RS		PA2
#define LCD_EN		PA3
#define LCD_Data	0xF0
#define LCD_Mask	0x0F
#define EN_SET		(LCD_PORT |= (1 << LCD_EN))
#define EN_CLEAR	(LCD_PORT &= ~(1 << LCD_EN))
#define RS_SET		(LCD_PORT |= (1 << LCD_RS))
#define RS_CLEAR	(LCD_PORT &= ~(1 << LCD_RS))

Byte LCD_String_Cnt;
Byte LCD_Column_Start[4] = {0x80,0xC0,0x94,0xD4};

void LCD_Send(Byte send, Byte flag)
{
	if(flag)
	{
		RS_SET;
	}
	else
	{
		RS_CLEAR;
	}
	LCD_PORT &= LCD_Mask;
	LCD_PORT |= (send & 0xF0);
	EN_SET;
	us(1);
	EN_CLEAR;
	LCD_PORT &= LCD_Mask;
	LCD_PORT |= ((send & 0x0F) << 4);
	EN_SET;
	us(1);
	EN_CLEAR;
	us(100);
}

void LCD_Clear(void)
{
	LCD_Send(0x01,0x00);
	ms(5);
}

void LCD_GotoXY(Byte x, Byte y)
{
	LCD_Send(((LCD_Column_Start[x-1]) + (y-1)),0x00);
}

void LCD_Print(char str[])
{
	LCD_String_Cnt = 0;
	while(str[LCD_String_Cnt] != 0x00)
	{
		LCD_Send(str[LCD_String_Cnt ++],0x01);
	}
}

void LCD_Init(void)
{
	LCD_DDR |= ((1 << LCD_RS) | (1 << LCD_EN));
	LCD_DDR |= LCD_Data;
	RS_CLEAR;
	EN_CLEAR;
	ms(100);
	LCD_PORT &= LCD_Mask;
	LCD_PORT |= 0x20;
	EN_SET;
	us(1);
	EN_CLEAR;

	LCD_Send(0x2C,0x00);	// Function Set
	LCD_Send(0x0C,0x00);	// Display ON, Cursor and Blink OFF
	LCD_Clear();
	LCD_Send(0x06,0x00);	// Entry Mode Set
}

// E-Paper Section

#define EP_Wake_Up_Pin		PD2
#define EP_Reset_Pin		PD3
#define EP_DDR			DDRD
#define EP_PORT			PORTD
#define EP_Baud			115200
#define EP_UBRR_Value	((F_CPU / (16 * (EP_Baud))) - 1)
#define EP_Frame_Header		0xA5
#define EP_Frame_End_1		0xCC
#define EP_Frame_End_2		0x33
#define EP_Frame_End_3		0xC3
#define EP_Frame_End_4		0x3C
#define EP_Command_Max_Length		1033
#define EP_CMD_Handshake			0x00
#define EP_CMD_Storage_Get			0x06
#define EP_CMD_Storage_Set			0x07
#define EP_CMD_Stop					0x08
#define EP_CMD_Refresh_Update		0x0A
#define EP_CMD_Set_Draw_Color		0x10
#define EP_CMD_Get_Draw_Color		0x11
#define EP_CMD_Fill_Circle			0x27
#define EP_CMD_Clear				0x2E
#define EP_Handshake_Type			0x01
#define EP_Storage_Get_Type		    0x01
#define EP_Storage_Set_Type			0x02
#define EP_Stop_Type				0x01
#define EP_Refresh_Update_Type		0x01
#define EP_Set_Draw_Color_Type		0x03
#define EP_Get_Draw_Color_Type		0x01
#define EP_Fill_Circle				0x04
#define EP_Clear_Type				0x01
#define EP_CMD_Display_Image		0x70
#define EP_Type1_Length				0x0009
#define EP_Type2_Length				0x000A
#define EP_Type3_Length				0x000B
#define EP_Type4_Length				0x000F
#define EP_Display_Image_CMD_Length(EP_String_Length)		((0x000D) + (EP_String_Length))
#define EP_Response_Timeout_ms		1000			// Max allowed value for now is 2540

Byte EP_Parity_Loop_Counter, EP_Command_Array[EP_Command_Max_Length], EP_Parity, EP_String_Length, EP_Image_Name_Length;
Byte EP_Image_String_Counter, EP_Command_Array_Universal_Counter, EP_Command_Array_Local_Counter, EP_Response_ms_Counter;
volatile Byte Rx_Byte;
Word EP_Full_Command_Length, EP_Response_us_Counter;

void EP_USART_Init(void)
{
	UCSR0B |= ((1 << TXEN0) | (1 << RXEN0));
	UCSR0C |= ((1 << UCSZ00) | (1 << UCSZ01));
	UBRR0L = EP_UBRR_Value;
}

void EP_UART_Tx(volatile Byte EP_Tx)
{
	while(!(UCSR0A & (1 << UDRE0)));
	UDR0  = EP_Tx;
	while(!(UCSR0A & (1 << TXC0)));
	UCSR0A |= (1 << TXC0);
}

volatile Byte EP_UART_Rx(void)
{
	EP_Response_us_Counter = 0;
	EP_Response_ms_Counter = 0;
	while(!(UCSR0A & (1 << RXC0)))
	{
		us(1);
		EP_Response_us_Counter += 1;
		if(EP_Response_us_Counter >= 10000)
		{
			EP_Response_us_Counter = 0;
			EP_Response_ms_Counter += 1;
			if(EP_Response_ms_Counter >= (EP_Response_Timeout_ms / 10))
			{
				return 0xFF;
			}
		}
	}
	return UDR0;
}

Byte EP_Parity_Generator(Word EP_Command_Length)
{
	EP_Parity = 0x00;
	EP_Command_Length -= 1;
	for(EP_Parity_Loop_Counter = 0; EP_Parity_Loop_Counter < EP_Command_Length; EP_Parity_Loop_Counter ++)
	{
		EP_Parity ^= EP_Command_Array[EP_Parity_Loop_Counter];
	}
	return EP_Parity;
}

void EP_Display_Image(char EP_Image_Name[], Word EP_Image_X_Start_Pos, Word EP_Image_Y_Start_Pos)
{
	EP_Image_String_Counter = 0;
	EP_Command_Array_Universal_Counter = 4;
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)((EP_Image_X_Start_Pos & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)(EP_Image_X_Start_Pos & 0x00FF);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)((EP_Image_Y_Start_Pos & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)(EP_Image_Y_Start_Pos & 0x00FF);
	while(EP_Image_Name[EP_Image_String_Counter] != 0x00)
	{
		EP_Command_Array[EP_Command_Array_Universal_Counter ++] = EP_Image_Name[EP_Image_String_Counter ++];
	}
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = 0x00;
	EP_Image_String_Counter += 1;
	EP_Full_Command_Length = EP_Display_Image_CMD_Length(EP_Image_String_Counter);
}

void EP_Display_Circle(Word EP_Circle_Center_X_Pos, Word EP_Circle_Center_Y_Pos, Word EP_Circle_Radius)
{
	EP_Command_Array_Universal_Counter = 4;
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)((EP_Circle_Center_X_Pos & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)(EP_Circle_Center_X_Pos & 0x00FF);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)((EP_Circle_Center_Y_Pos & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)(EP_Circle_Center_Y_Pos & 0x00FF);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)((EP_Circle_Radius & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Universal_Counter ++] = (Byte)(EP_Circle_Radius & 0x00FF);
}

void EP_Get_Response(void)
{
	do
	{
		Rx_Byte = EP_UART_Rx();
		if((Rx_Byte >= Valid_ASCII_Lowest) && (Rx_Byte <= Valid_ASCII_Highest))
		{
			LCD_Send(Rx_Byte, 0x01);
		}
	}while(Rx_Byte != 0xFF);
	LCD_Print(" ");
}

void EP_Send_Command(Byte EP_Command_ID, Byte EP_Command_Type)
{
	if(EP_Command_Type != 0x00)
	{
		if(EP_Command_Type == 0x01)
		{
			EP_Full_Command_Length = EP_Type1_Length;
		}
		else if(EP_Command_Type == 0x02)
		{
			EP_Full_Command_Length = EP_Type2_Length;
		}
		else if(EP_Command_Type == 0x03)
		{
			EP_Full_Command_Length = EP_Type3_Length;
		}
		else if(EP_Command_Type == 0x04)
		{
			EP_Full_Command_Length = EP_Type4_Length;
		}
	}
	EP_Command_Array_Local_Counter = 0;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Frame_Header;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = (Byte)((EP_Full_Command_Length & 0xFF00) >> 8);
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = (Byte)(EP_Full_Command_Length & 0x00FF);
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Command_ID;
	if(EP_Command_Type == 0x02)
	{
		EP_Command_Array[EP_Command_Array_Local_Counter ++] = 0x01;		// Currently built for setting storage to TF card. Build this further for inclusion of additional functions with length of 0x0A (type2)
	}
	else if(EP_Command_Type == 0x03)
	{
		EP_Command_Array[EP_Command_Array_Local_Counter ++] = 0x03;     // Foreground color. 0x03 - White
		EP_Command_Array[EP_Command_Array_Local_Counter ++] = 0x00;     // Background color. 0x00 - Black
	}
	else if((EP_Command_Type == 0x00) || (EP_Command_Type == 0x04))
	{
		EP_Command_Array_Local_Counter = EP_Command_Array_Universal_Counter;
	}
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Frame_End_1;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Frame_End_2;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Frame_End_3;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Frame_End_4;
	EP_Command_Array[EP_Command_Array_Local_Counter ++] = EP_Parity_Generator(EP_Full_Command_Length);
	for(EP_Command_Array_Local_Counter = 0; EP_Command_Array_Local_Counter < EP_Full_Command_Length; EP_Command_Array_Local_Counter ++)
	{
		EP_UART_Tx(EP_Command_Array[EP_Command_Array_Local_Counter]);
	}
	EP_Get_Response();
}

void EP_Wake_Up(void)
{
	EP_PORT &= ~(1 << EP_Wake_Up_Pin);
	us(10);
	EP_PORT |= (1 << EP_Wake_Up_Pin);
	us(500);
	EP_PORT &= ~(1 << EP_Wake_Up_Pin);
	ms(10);
}

void EP_Reset(void)
{
	EP_PORT &= ~(1 << EP_Reset_Pin);
	us(10);
	EP_PORT |= (1 << EP_Reset_Pin);
	us(500);
	EP_PORT &= ~(1 << EP_Reset_Pin);
	ms(3000);
}

void EP_Init(void)
{
//	char tmp_print[2];
//	ms(5000);
	EP_USART_Init();
	EP_DDR |= ((1 << EP_Wake_Up_Pin) | (1 << EP_Reset_Pin));
	EP_Wake_Up();
//	EP_Reset();
	LCD_GotoXY(2,1);
	EP_Send_Command(EP_CMD_Storage_Set, EP_Storage_Set_Type);   // Getting Response - "OK"
	EP_Send_Command(EP_CMD_Storage_Get, EP_Storage_Get_Type);   // Getting Response - "1"
//	EP_Send_Command(EP_CMD_Set_Draw_Color, EP_Set_Draw_Color_Type); // Getting Response - "OK"
//	EP_Send_Command(EP_CMD_Get_Draw_Color, EP_Get_Draw_Color_Type); // Getting Response - "30"
//	EP_Send_Command(EP_CMD_Clear, EP_Clear_Type); // Getting Response - "OK"
//	EP_Display_Circle(400, 300, 200); // Getting Response - "OK"
//	EP_Send_Command(EP_CMD_Fill_Circle, EP_Fill_Circle); // Getting Response - "OK"
	EP_Display_Image("E1.BMP", 0x0000, 0x0000);
	EP_Send_Command(EP_CMD_Display_Image, 0x00); // Getting Response - "OK"
	EP_Send_Command(EP_CMD_Refresh_Update, EP_Refresh_Update_Type); // Getting Response - "OK"
	EP_Send_Command(EP_CMD_Stop, EP_Stop_Type); // Getting Response - "0"
}

int main(void)
{
	LCD_Init();
	EP_Init();
    while(1);
}

Please note that I have already tried many combinations such as introducing Handshake at the start, varying delays for timeout of response, removing the response checking altogether, changing arguments for 'set_color' command, changing image name, changing many parameters of image and more. Nothing has worked so far. 

 

P.S. Currently I am displaying image from SD card. The image is being displayed but with contrast issue. I have also tried displaying image from internal NAND flash (in arduino code, using the demo). Result stays the same. 

Last Edited: Tue. Feb 13, 2018 - 03:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems far more likely to be the electrical setup (Vcc level etc) than anything done in the 1284 software. Like Andy I would ask Waveshare to tell you what it is that influences contrast.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have already dropped a message to Waveshare, as they are never online for the chat (I have observed this for 2 days in row now). I have also sent them an email regarding this but I have got an automated response stating that they're having a vacation for a week! Anyway, as far as the user manual is concerned, 5V should be flawless but it is not the case for me. I have measured the voltage available to module and it is 5.02V. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Eh??

 

In #6 you said they've accepted that it's faulty, and have already given you a returns number?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am sorry for not making it clear before. I have bought the display from this seller: http://www.rhydolabz.com/displays-c-88/43-inch-serial-interface-electronic-paper-display-p-2036.html?zenid=6b9803f52d6e50cd052b878c8d74dae0. They have accepted my request for the replacement. I have tried contacting Waveshare but they are not responsive as of now. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oh - I see.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chinese new year. China stops for a week or so.
Gong xi fat choi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Russell ;-)

He's employing the well-known Melbourne comma.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:

Russell ;-)

He's employing the well-known Melbourne comma.

Yes, extremely subtle it is. ;-)

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Thu. Feb 15, 2018 - 06:56 PM