AnsweredAssumed Answered

STM8 not driving LCD

Question asked by Billy Bob on Jan 6, 2017
Latest reply on Feb 15, 2017 by Billy Bob

I have a custom LCD that I am trying to drive with the STM8L052C6. I have tested the LCD with 2 other MCUs and it works fine. However, when I try to drive it with the STM8, it is very dim and almost not visible. I probed the pins on another MCU that works and compared it with the STM8 trying to drive it.

LCD Pin Signals

This image shows the STM8 vs a working MCU. For some reason, the STM8 will drive to the correct voltage briefly then will drop. I'm not sure what could be causing this. I have tried to change parameters in almost every LCD related register. 

Any ideas would be greatly appreciated. I've been stuck on this for quite some time. 

Here's my code to test the LCD:


CLK_CRTCR = 0b00000100; //RTC(LCD) uses LSI clock, Div CLK by 8
CLK_ICKCR |= 0b100; //Turn on LSI clock
while(!(CLK_ICKCR & 0b1000) );
CLK_PCKENR2 |= 0b1100; //Enable clk to LCD. 0b1100 AND RTC
LCD_CR1 = 0b110; //Set Blink off, 1/4 duty cycle, 1/3 bias
LCD_CR2 = 0b11101110; //Internal voltage ref, contrast high
LCD_FRQ = 0b00000000; //divide LCD clock down
LCD_PM0 = 0b10010010; //Seg0-7, seg1, seg4, seg7
LCD_PM1 = 0b00000000; //Seg8-15
LCD_PM2 = 0b10110000; //Seg16-23, seg20, seg21, seg23
LCD_PM3 = 0b00000100; //Seg24-31, seg26
LCD_RAM0 = 0xFF;
LCD_RAM1 = 0xFF;
LCD_RAM2 = 0xFF;
LCD_RAM3 = 0xFF;
LCD_RAM4 = 0xFF;
LCD_RAM5 = 0xFF;
LCD_RAM6 = 0xFF;
LCD_RAM7 = 0xFF;
LCD_RAM8 = 0xFF;
LCD_RAM9 = 0xFF;
LCD_RAM10 = 0xFF;
LCD_RAM11 = 0xFF;
LCD_RAM12 = 0xFF;
LCD_RAM13 = 0xFF;
LCD_CR3 = 0b01000000; //LCD enable, low dead time(higher current)
CLK_CCOR = 0b11100100; //CCO is LSI div 64
PC_DDR |= 0b10000;
PC_CR1 |= 0b10000;