2017-01-05 08:39 PM
I have a custom LCD that I am trying to drive with theSTM8L052C6. 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.
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;
#voltages #stm8 #lcd #pins #display #init #not-working #drive
Solved! Go to Solution.
2017-01-13 03:57 AM
2017-01-06 06:21 AM
Setting
LCD_CR2
.HD would not help?
JW
2017-01-12 09:26 PM
Thanks for the response. I tried setting that bit again just to be sure. For some reason, when that bit it set, the LCD is nearly invisible. It might be completely off. I don't have my scope with me to check, but it seems to make the problem worse. Any other ideas as to what could cause this?
2017-01-13 03:50 AM
No.
Don't you have by any chance a STM8L Discovery? It has an onboard LCD and you could check the waveforms and the response of LCD to various settings there easily.
JW
2017-01-13 03:57 AM
Check VLCD
-NC
2017-02-15 02:30 AM
Thank you!
The problem was that I didn't have a capacitor placed on the VLCD pin. This was frustrating because it seemed like things would sometimes work, but if I slowed down the clock or even enabled LCD_CR2.HD the display would appear off. With the capacitor in place, it works fine.