Lefora Pro Forum
login join
Loading
999 views

Problem with conneting S64128K through SPI interface to STM32 MCU

Page 1
1–8
rookie - member
4 posts

Hi,
I'm trying to connect
S64128K display through its SPI interface to a STM32 MCU and not getting anything on display.
I have the display connected per attached diagram based on what you provided on your web site and all the caps are 1uF ceramics.
The code for initializing and setting all points on is as below.
I set different CPOL and CPHA on SPI connecting and none of them worked
I was wondering how can I check if the internal voltage booster is working? (there is no 9V on Vout pin)


#define LCDWIDTH 128
#define LCDHEIGHT 64

#define CMD_DISPLAY_OFF         0xAE
#define CMD_DISPLAY_ON          0xAF

#define CMD_SET_DISP_START_LINE 0x40
#define CMD_SET_PAGE            0xB0

#define CMD_SET_COLUMN_UPPER    0x10
#define CMD_SET_COLUMN_LOWER    0x00

#define CMD_SET_ADC_NORMAL      0xA0
#define CMD_SET_ADC_REVERSE     0xA1

#define CMD_SET_DISP_NORMAL     0xA6
#define CMD_SET_DISP_REVERSE    0xA7

#define CMD_SET_ALLPTS_NORMAL   0xA4
#define CMD_SET_ALLPTS_ON       0xA5
#define CMD_SET_BIAS_9          0xA2
#define CMD_SET_BIAS_7          0xA3


#define CMD_VOLTAGE_RATIO    0x20
#define CMD_VOLUME_MODE        0x81
#define CMD_VOLUME_SET        0x00
#define CMD_BOOSTER_RATIO    0xF8
#define CMD_POWERON        0x28

#define CMD_RMW                 0xE0
#define CMD_RMW_CLEAR           0xEE
#define CMD_INTERNAL_RESET      0xE2
#define CMD_SET_COM_NORMAL      0xC0
#define CMD_SET_COM_REVERSE     0xC8
#define CMD_SET_POWER_CONTROL   0x28
#define CMD_SET_RESISTOR_RATIO  0x20
#define CMD_SET_VOLUME_FIRST    0x81
#define CMD_SET_VOLUME_SECOND   0
#define CMD_SET_STATIC_OFF      0xAC
#define CMD_SET_STATIC_ON       0xAD
#define CMD_SET_STATIC_REG      0x0
#define CMD_SET_BOOSTER_FIRST   0xF8
#define CMD_SET_BOOSTER_234     0
#define CMD_SET_BOOSTER_5       1
#define CMD_SET_BOOSTER_6       3
#define CMD_NOP                 0xE3
#define CMD_TEST                0xF0

#define COMMAND         (u8)0
#define DATA            (u8)1
#define LCDCMD          (u8)0
#define POWERDOWN       1
#define ACTIVE          0
#define V_ADDR          1
#define H_ADDR          0
#define EXT_INS         1
#define BAS_INS         0

#define swap(a, b) { uint8_t t = a; a = b; b = t; }

void LcdEnable(u8);
void LcdWriteDC(u8, uint8_t);
void LcdWriteData(uint8_t);
void LcdWriteCommand(uint8_t);
void LcdInit(void);

extern void Delay(uint32_t);
extern void Send_SPI(uint8_t);

void SetBrightness(uint8_t);
void Set_Display(void);

/***************************************************************************/

void Send_SPI(uint8_t inchar)
{
   while (SPI_I2S_GetFlagStatus(SPIy, SPI_I2S_FLAG_TXE) == RESET)
   {
   } 
   SPI_I2S_SendData(SPIy, inchar);
  
}

void LcdEnable(u8 Enable)
{
  if( Enable == TRUE )
    GPIO_ResetBits(GPIOB, LCD_CS);
  else   
  {
    GPIO_SetBits(GPIOB, LCD_CS);
    GPIO_SetBits(GPIOB, LCD_A0);
  }
    Delay(1000);
}

void LcdWriteDC(u8 DC, uint8_t info)
{
  if( DC == DATA)        
    GPIO_SetBits(GPIOB, LCD_A0);
  else
    GPIO_ResetBits(GPIOB, LCD_A0); 
    Delay(10);
    Send_SPI(info);   
}

void LcdWriteData(uint8_t data)
{
        LcdWriteDC(DATA, data);
}


void LcdWriteCommand(uint8_t cmd)
{
        LcdWriteDC(COMMAND, cmd);
}

void LcdInit(void)
{
  GPIO_ResetBits(GPIOB, LCD_RES);  
  Delay(1);
  GPIO_SetBits(GPIOB, LCD_RES);  
  Delay(100);

  LcdWriteDC(LCDCMD ,CMD_VOLTAGE_RATIO +5);
  LcdWriteDC(LCDCMD ,CMD_VOLUME_MODE);
  LcdWriteDC(LCDCMD ,CMD_VOLUME_SET | 0x20);  
  LcdWriteDC(LCDCMD ,CMD_BOOSTER_RATIO);
  LcdWriteDC(LCDCMD ,0);  
  LcdWriteDC(LCDCMD ,CMD_POWERON + 7);  
  LcdWriteDC(LCDCMD ,CMD_SET_DISP_START_LINE | 0);
  LcdWriteDC(LCDCMD ,CMD_SET_PAGE | 0);
  LcdWriteDC(LCDCMD ,CMD_SET_COLUMN_UPPER | 0);
  LcdWriteDC(LCDCMD ,CMD_SET_COLUMN_LOWER | 0);
  LcdWriteDC(LCDCMD ,CMD_VOLUME_MODE);
  LcdWriteDC(LCDCMD ,CMD_VOLUME_MODE); 
  LcdWriteDC(LCDCMD ,CMD_SET_ALLPTS_NORMAL);  
  LcdWriteDC(LCDCMD ,CMD_DISPLAY_ON);  
  LcdWriteDC(LCDCMD ,CMD_SET_ALLPTS_ON);  

}

novice - member
29 posts

Hi p_bondar,

Let me look at the code for you.  By any chance you can post the sch in pdf format for better clarity.  Thanks.

novice - member
29 posts

Hi P_bondar,

I assume you are using a 3.3V power supply to the display.  If you are configuring the display to use the maximum booster configuration in hardware and software, you should get 16V max at booster cap.  I need to find that specific section int datasheet but there is a plot there on output voltage versus boost level.  I will chk into that and find the page for you.

Thanks.

novice - member
29 posts

Hi P_Bondar,

A quick look at your code could ont review anything obviously incorrect.  However, please try to do a simple bit bang on the device if possible to make sure there is no additional complication coming from the SPI hardware.  Secondly, I assume you have defined all the pin somewhere else: the code you cut n paste here does not contain definition for the all the LCD_xx pins.  Also, please do make sure the top three bits of the booster is configured as shown on the datasheet.  The STM32 is tricky sometimes to get the IO pins to configure properly so it is always good idea to chk with a scope or a logic analyzer to make sure the bit pattern is shifted out as you have designed.

I will look at it some more and see if I could offer you some simple C code template for this.

Thanks

rookie - member
4 posts

Thanks for your reply,
My problem is that there is no way to find out if the LCD is receiving my commands or not? and if the booster is working or not?
Can you tell me what voltages should I expect to have on different pins of this LCD after powering up?
I also uploaded the PDF file.

Attachment: SCHEMATIC1 _ LCD.pdf (25.0KB)

rookie - member
4 posts

Hi,
I did a bit bang and still not getting any respond from the LCD. Is there any Eval kit or 3rd party product with SPI interface for this display?
Here is the code for this

void Send_SPI(uint8_t inchar)
{
  uint8_t i;
 for(i=0;i<8;i++)
 {
  if(inchar & 0x80)
  {
    GPIO_SetBits(GPIOA, SPI_SCK);
    Delay(1000);    
    GPIO_ResetBits(GPIOB, LCD_CS);   
    Delay(1000);   
    GPIO_SetBits(GPIOA, SPI_MOSI);   
    Delay(1000);
    GPIO_ResetBits(GPIOA, SPI_SCK); 
    Delay(1000);
    GPIO_SetBits(GPIOA, SPI_SCK);
    Delay(1000);    
    GPIO_SetBits(GPIOB, LCD_CS);    
    Delay(1000);   
  }
  else
  {
    GPIO_SetBits(GPIOA, SPI_SCK);
    Delay(1000);    
    GPIO_ResetBits(GPIOB, LCD_CS);   
    Delay(1000);    
    GPIO_ResetBits(GPIOA, SPI_MOSI);   
    Delay(1000);
    GPIO_ResetBits(GPIOA, SPI_SCK); 
    Delay(1000);
    GPIO_SetBits(GPIOA, SPI_MOSI);
    Delay(1000);    
    GPIO_SetBits(GPIOA, SPI_SCK);
    GPIO_SetBits(GPIOB, LCD_CS);    
    Delay(1000);      
  }
  inchar<<=1;
 }
   GPIO_ResetBits(GPIOB, LCD_A0);
}

novice - member
29 posts

Hi P_Bondar,

Would you please confirm you intention of the booster level based on the pdf file you posted here and p32 of the Sitronix datasheet ?Are you intending to do a 4X booster ?  You are on the right track.  The best way to check your code is to send the init code and see if you could turn on the dc-dc booster circuit.

Also, pls make sure the booster ratio is set correctly per page 48 of the datasheet.

Please let me know what you found.  I think Vout is not connected correctly on your sch.

Thanks.

rookie - member
4 posts

Hi,
I've used the sample design file on your website (64128k_l_m-testerschematic(serial)-080902) as my reference. Referring to that sample design VOUT is connected to GND. By the way I'll connect this pin to 3.3V and will check it again and will post the result.

Thanks,

Page 1
1–8

Locked Topic


You must be a member to post in this forum

Join Now!