NHD-320240WG-BxTGH-VZ#-3VR initialization sequence
I am having trouble getting the above display to light up. I've brought up close to a dozen other displays before, but been completely stumped by this one. By outward appearances, the display never comes out of sleep, my reference is the YDIS pin on the S1D13700 that never goes high. V0 is at -18.8V, VDD at 3.3V, and I have all the digital signal timing extremely conservative (50us between any IO Bus signal changes, 3ms for Reset). All have been verified with an oscilloscope. The only thing I see as strange is that the example initialization code in the datasheet is for 6800 signalling and the display is wired for 8080 signalling. I'm using 8080 signalling and have measured out the CNF pins on the module to confirm it should be 8080 signalling.
I fear I did destroy one display as while probing signals I think my probe slipped and shorted the V0 signal to one of the control signals. I have two other displays still and using those.
I am sure the displays are fine (or at least hope so!!) and there is something extremely fundamental I'm overlooking. I've been at it three weekends now and still no luck so finally asking for help. All DC voltages look good, Reset timing is good, and timing/data for writing out the initialization strings look good (verified each bit on the scope too). I have tried an experiment where I try to read back data written to DDRAM. I get zero's back always, but not as confident of that code.
Thanks in advance. Can't figure out why this display is stumping me. Any suggestions appreciated.
-
Hi,
Would it be possible to share your code for the initialization process? Along with what you are trying to output onto the display?0 -
Saurabh_B: Sure, thanks, here goes. It is a decent-sized post though: It is for an STM32F1xxx chip and CMSIS drivers. I've had the code not use the involved structures earlier which may have been easier to read, but it was same results.
*** Relevant Defines ****
#define LCD_RST GPIO_Pin_11
#define LCD_CS GPIO_Pin_12
#define LCD_RD GPIO_Pin_14
#define LCD_WR GPIO_Pin_13
#define LCD_A0 GPIO_Pin_10
*** Relevant Data structures ***
#define NINITSEQ 9
uint8_t LCD_Init1[10] = { 9,0x40,0x30,0x87,0x07,0x27,0x50,0xef,0x28,0x00} ; // System Set
uint8_t LCD_Init2[12] = {11,0x44,0x00,0x00,0xef,0xb0,0x04,0xef,0x00,0x00,0x00,0x00} ; // Scroll
uint8_t LCD_Init3[ 3] = { 2,0x5a,0x00} ; // HDOT (not shifted)
uint8_t LCD_Init4[ 3] = { 2,0x5b,0x00} ; // Overlay (OR mode)
uint8_t LCD_Init5[ 3] = { 2,0x58,0x56} ; // Display off, overlay merge modes
uint8_t LCD_Init6[ 4] = { 3,0x46,0x00,0x00} ; // Cursor position
uint8_t LCD_Init7[ 4] = { 3,0x5d,0x04,0x85} ; // Cursor form
uint8_t LCD_Init8[ 2] = { 1,0x59} ; // Display On (no data byte???)
uint8_t LCD_Init9[ 2] = { 1,0x4c} ; // Cursor direction
uint8_t* LCD_InitSeq[NINITSEQ] = {LCD_Init1,LCD_Init2,LCD_Init3,LCD_Init4,LCD_Init5,
LCD_Init6,LCD_Init7,LCD_Init8,LCD_Init9} ;
*** Calling Code Snippet ***
/* Initialize all control bits into a benign state */
/* RST*, CS*, RD* and WR* all to 1's */
GPIO_WriteBit(GPIOB, LCD_RST, Bit_SET);
GPIO_WriteBit(GPIOB, LCD_CS , Bit_SET);
GPIO_WriteBit(GPIOB, LCD_WR , Bit_SET);
GPIO_WriteBit(GPIOB, LCD_RD , Bit_SET);
/* Assert and de-assert reset to the display */
GPIO_WriteBit(GPIOB, LCD_RST, Bit_RESET);
Stall_Ms(3) ;
GPIO_WriteBit(GPIOB, LCD_RST, Bit_SET);
Stall_Ms(3) ;
/* Send out all nine initialization sequences */
for(i=0;i<NINITSEQ;i++)
{
Send_LCD_Init(LCD_InitSeq) ;
Stall_Ms(2) ;
}
/* Initialize display memory, cursor is write address (0x0000) */
LCD_Write_Byte(0,0x46) ;
LCD_Write_Byte(1,0x00) ;
LCD_Write_Byte(1,0x00) ;
/* write out 32,000 bytes of data */
LCD_Write_Byte(0,0x42) ;
for (b=0;b<32000;b++)
{
LCD_Write_Byte(1,(uint8_t)b%64+64) ;
}
/* Now read back display memory, cursor is read address (0x0000) */
LCD_Write_Byte(0,0x46) ;
LCD_Write_Byte(1,0x00) ;
LCD_Write_Byte(1,0x00) ;
/* read 32,000 bytes of data */
LCD_Write_Byte(0,0x43) ;
for (b=0;b<32000;b++)
{
i = LCD_Read_Byte(1) ;
}
*** Routines ***
/*******************************************************************************
* Routne : Send_LCD_Init
* Gazintas : seq - the initialization sequence to send
* IOs : None
* Returns : Nothing (cannot fail)
* Globals : None
*
* This sends an initialization sequence. The sequence starts with the byte
* count, the command byte, and finally any data.
*
*******************************************************************************/
void Send_LCD_Init(uint8_t* seq)
{
int i = 0 ;
LCD_Write_Byte(0,seq[1]) ;
if (seq[0]>1)
{
for (i=2;i<=seq[0];i++)
{
LCD_Write_Byte(1,seq) ;
}
}
}
/*******************************************************************************
* Routne : LCD_Write_Byte
* Gazintas : reg - register (0 or 1)
* : data - data to write (8 bits)
* IOs : None
* Returns : Nothing (cannot fail)
* Globals : None
*
* This is the basic low level write routine to the LCD
*
*******************************************************************************/
void LCD_Write_Byte(uint8_t reg, uint8_t data)
{
uint16_t Data_Set = 0 ;
uint16_t Data_Reset = 0 ;
/* Since reads are rare, going to assume the interface is alwasy in write */
/* mode (data driven). Reads will swap direction back to write when done. */
/* This is just a debugging aid, wiggle the dev board LED */
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET);
/* To set up data on port B bits 0-7 without disturbing anything else, */
/* create set/reset bits for just bits 0-7 */
Data_Set = ((uint16_t)( data))&0xff ;
Data_Reset = ((uint16_t)(~data))&0xff ;
GPIO_SetBits(GPIOB,Data_Set);
GPIO_ResetBits(GPIOB,Data_Reset);
/* Set the A0 bit (reg) and assert CS* */
GPIO_WriteBit(GPIOB, LCD_A0, (BitAction)((reg)&0x01));
//GPIO_WriteBit(GPIOB, LCD_A0, (BitAction)((~reg)&0x01));
GPIO_WriteBit(GPIOB, LCD_CS, Bit_RESET);
Stall_Us(50) ;
/* Now go toggle WR* */
GPIO_WriteBit(GPIOB, LCD_WR, Bit_RESET);
Stall_Us(50) ;
GPIO_WriteBit(GPIOB, LCD_WR, Bit_SET);
Stall_Us(50) ;
/* finally, de-assert CS* */
GPIO_WriteBit(GPIOB, LCD_CS, Bit_SET);
Stall_Us(50) ;
/* that should be it, no need for any other clean-up */
/* OK, for debugging, de-wiggle the dev board LED */
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_RESET);
}
/*******************************************************************************
* Routne : LCD_Read_Byte
* Gazintas : reg - register (0 or 1)
* IOs : None
* Returns : Data read (8 bits)
* Globals : None
*
* This is the basic low level read routine for the LCD
*
*******************************************************************************/
uint8_t LCD_Read_Byte(uint8_t reg)
{
GPIO_InitTypeDef GPIO_InitStructure;
uint16_t current = 0 ;
/* This is just a debugging aid, wiggle the dev board LED */
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET);
/* Put the 8 data bits of the MCU into input mode */
/* GPIO_Init() is a VERY SLOW routine! Optimize later */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Set the A0 bit and assert CS* */
GPIO_WriteBit(GPIOB, LCD_A0, (BitAction)((reg)&0x01));
//GPIO_WriteBit(GPIOB, LCD_A0, (BitAction)((~reg)&0x01));
GPIO_WriteBit(GPIOB, LCD_CS, Bit_RESET);
Stall_Us(50) ;
/* Now go toggle RD*, reading data before de-asserting RD* */
/* Measured on a scope, and pulse is TBDns, so in spec */
GPIO_WriteBit(GPIOB, LCD_RD, Bit_RESET);
Stall_Us(50) ;
current = GPIO_ReadInputData(GPIOB) ;
GPIO_WriteBit(GPIOB, LCD_RD, Bit_SET);
Stall_Us(50) ;
/* de-assert CS* */
GPIO_WriteBit(GPIOB, LCD_CS, Bit_SET);
/* Put data bits back into write mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
Stall_Us(50) ;
/* that should be it, no need for any clean-up */
/* OK, de-wiggle the debug LED. */
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_RESET);
/* return the read value */
return (current&0xff) ;
}0 -
Saurabh_B: I realize I didn't fully answer your original question. As to what I intended to display, right now it is *anything*. As you can see from the code I am just filling display memory with printable ASCII bytes such that once the display turns on I should see something, character or graphic. Once to that point I am sure I can progress rapidly. I have a bunch of code written up for the NHD-14432WG-BTFH-V#T for my last project (different controller) that I am porting to the S1D13700 now.
On the hardware side I have looked at each of the 17signals *on the back of the display* with a scope and compared them to pin listing on the NHD datasheet. Trying make sure I didn't do something dumb in the translation. The DC-DC converter is clearly going fine as I do get the negative voltage. My focus is the YDIS signal of the S1D13700 as the best indicator of problems. Hence focusing on just the first command sequence as the display should fire up after the P1 parameter is sent.
will0 -
Your initialization sequence seems fine.
You have your Data Write function to set up so that your first byte would be a command followed by the rest of the information you send.
When you are sending information to the display can you confirm that the function isn't sending a command before the byte you would like to use?0 -
Saurabh_B: Yes, the sequences are interpreted as a command byte first followed by 0 or more data bytes. Not quite sure I understand your question. The command byte is first followed by data. Are you asking if I send a command byte before each data byte in the sequence? If that's the question, definitely no. One thing I have done is put the entire command sequence, including the reset sequence into an infinite loop to check with an oscilloscope that the data being sent matches the sequences in the code above. It is only those bytes in that sequence. I have tried writing to and reading back display memory (addresses 0x0000-0x7fff), but that does not seem to work. Given the display is in sleep mode, I am not sure if it should work or not.
will0 -
This has been solved, the problem was due to the RS pin.
RS= 1 would be a Command.
RS = 0 would be Data.0
Please sign in to leave a comment.
Comments
6 comments