I'm playing with a DOGM132-5 LCD, which is the same one Dave used in his credit card calculator.
The LCD is powered by 3.3V, I am using the example low voltage circuitry provided in the manual (several capacitors to utilize the LCD's built in boost converter)
Here's what my initialization roughly looks like
cbi(PORTD, 3); // reset
_delay_us(50);
sbi(PORTD, 3); // release
_delay_us(50);
lcd_sendChar(0b01000000, 0); // display start line 0
lcd_sendChar(0b10100000, 0); // ADC reverse for upside down
lcd_sendChar(0b11001000, 0); // common mode reverse (for upside-down)
lcd_sendChar(0b10100110, 0); // display normal order
lcd_sendChar(0b10100010, 0); // set LCD bias to 1/9 (duty 1/33)
lcd_sendChar(0b00101111, 0); // pwr ctrl: booster, reg, and follower on
lcd_sendShort(0xF800, 0); // set internal booster to 3x/4x
lcd_sendChar(0b00100011, 0); // v0 v-reg set (contrast set)
lcd_sendShort(0x811F, 0); // elec volume mode set (contrast set)
...
set page and column, start writing data for animation
The manual is here:
http://www.lcd-module.com/eng/pdf/grafik/dogm132-5e.pdfThere is another datasheet for the internal controller:
http://www.lcd-module.com/eng/pdf/zubehoer/st7565r.pdfthis startup sequence is derived from the manual, except I have changed it slightly because I need to use my LCD in up-side-down mode. (it is important to note that my animation is being displayed in the correct mode every time, so I know that the set of commands I am sending is correct)
the problem is that this works only sometimes, when I can see a test animation I wrote become displayed on the screen. since the animation works, I can safely assume my SPI routines are ok, and I can also assume that my wiring is correct.
note that it works (animation being displayed) at first power on quite frequently (about 50% of the time, unplugging and replugging the main power will cause the animation to show), but hardly ever upon resetting my microcontroller.if I see my animation and then press reset on my microcontroller, the screen goes blank, but my pattern is not re-written, the LCD appears blank and idle. The animation NEVER works twice in a row, interrupting the animation by pressing the reset button on the microcontroller will guarantee that the animation will not show up.
here's the really weird part, if I wait maybe a minute, and then press reset, it starts displaying my animation again, but if i press reset quickly, my animation disappears
A few more things to note:
as you can see, the function where I send two consecutive bytes is called lcd_sendShort, I'm not sure if I'm supposed to deselect and reselect the CS pin in between the two bytes. I tried without deselecting CS and the behaviour is worse, no animation is ever displayed.
there is nothing telling me the minimum time between commands, or the minimum period for which CS should be de-asserted before being re-asserted between commands. The DOGM model does not give me any read capability so I am unable to check the BUSY flag. Adding a 1 microsecond delay between commands does not help.
there is apparently a requirement for the power-on procedures to be completed within 5ms, but my timing should be within that
one concern is that I may have entered a two byte command sequence without exiting it by pressing reset at just the right moment, to counter this, I have tested the startup sequence with a NOP command, which is meant to exit any "waiting for 2nd byte" state, and it made no difference to my problem
I have also tried a combination of software (the LCD does have a soft-reset command) and hardware reset (toggle the reset pin) method, makes no difference
Attempting to measure the voltage outputted by the boost converter will cause the screen to go blank, which probably means my multimeter is sinking too much current
I do not have an oscilloscope to monitor the boost converter.
Another thing (irrelevant to my problem) that is frustrating is that the LCD's internal display RAM is not reset by the hardware reset or the software reset, which is actually a documented fact in the datasheet. This is super annoying as I have to manually for-loop to clear every RAM location manually.
edit: FIXED