LCD White

Posted on
  • Hello,

    I have a STM32 2.4 inch LCD Board (VET6). The LCD works fine in the Web IDE, but when I type save() and it loads to flash, the screen comes back white and does not respond to commands. The rest of the program appears to be operating (in the example below the lights keep flashing):

    function toggle1() {
    on1 = !on1;
    digitalWrite(LED4, on1);
    LCD.drawString("Hello World!", 1, 20);
    }
    function toggle2() {
    on2 = !on2;
    digitalWrite(LED3, on2);
    LCD.clear();
    }

    var l = false;
    setInterval("digitalWrite(LED1,l=!l);",2­00);

    setWatch(toggle1, E4, {repeat: true, edge:'falling'});
    setWatch(toggle2, E3, {repeat: true, edge:'falling'});

    The LCD displays the Espruino start screen fine when not connected to the computer (mobile phone power supply) and it has just been flashed in "Flash Loader Demo". Do I have to initialise the screen, am I missing something obvious?

    Many thanks,

    Harry

  • Aha! I have it.

    1) Plug in the board with button 1 held down
    2) Re-connect in IDE
    3) Save(); in terminal
    4) Reset(); in terminal
    5) Copy and paste code in to terminal
    6) Save(); as normal

  • Sorry, wrong thread.

  • Serge's version at espruino-nightly.noda.se/2013-11-22/hyst­m32_24/ works perfectly and removes all the problems I'd been experiencing - I am now able to make the most of Espruino's power! A great tool. Thanks for making it Gordon.

  • Great! Something must have changed that caused problems with the program loading... Doses 2013.11.23 not work? It might help to narrow this down...

  • I downloaded the latest version on the website a week ago - that was the version I was using.
    I found if I put delays (digital pulse) in between all my instructions, I could get the LCD to operate on save(); - however it was temperamental and results were not always repeatable. I programmed in a constantly flashing light so I could tell if it had hung or not, which would happen quite often. However, sometimes the light would flash but the LCD would just be white. Adding a delay or changing the delay time sometimes fixed this.

  • Hi Harry,

    Thanks for the info... I've just looked into this a bit and it definitely seems to be an issue with the LCD driver. If I compile without LCD support then everything works.

    Interesting about the delay. Could you give an example? I tried adding a big FOR loop here and it didn't help matters.

    If you do manage to work forwards and find the nightly at which it stops working, it'd be a lot easier to narrow down exactly what the issue was.

  • Hi Gordon,
    Sorry, I'm not too familiar with the nightly build concept - I downloaded on the 30th Jan if that helps.

    An example of the delays I built in were as follows:

    function toggle3() {
    	LCD.clear();
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.setColor(0, 0, 0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.fillRect(1, 1, 320, 240);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.setColor(0, 1, 0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	PotPos = analogRead(C0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
        LCD.drawString(PotPos, 230, 210);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	setInterval(function() {
          LCD.clear();
          digitalPulse(A2,1,20);
          digitalPulse(A2,0,20);
          PotPos = analogRead(C0);
          digitalPulse(A2,1,20);
          digitalPulse(A2,0,20);
          LCD.drawString(PotPos, 200, 210);
    	}, 200);
    
    	digitalWrite(LED2,p=!p);
    }
    
    var l = false;
    var p = false;
    var PotPos = 0.1;
    
    setInterval("digitalWrite(LED1,l=!l);",8­00);
    
    setWatch(toggle3, E5, {repeat: true, edge:'falling'});
    

    Whether or not this program worked was dependent on the digitalPulse duration, and was often not repeatable. I found mathematical operations were less fussy than instructions involving the LCD.

    Introducing a SetInterval made things more complicated, and sometimes seemed to want a couple of digitalPulses at the end of the loop, and sometimes didn't. I'd have to evaluate one step at a time and see if it crashed.

  • Hmm, that is strange. I think it may just be general instability when initialising the LCD though as I'm not sure that any of that would really affect it too much.

    With the nightlies: There is a build of Espruino made every night, and they're all listed here: http://espruino-nightly.noda.se

    For instance Serge's suggestion was from 22nd November 2013.

    If you can find a date where it works fine, and then the next day it's broken, I can look back at all the changes I made on that date in order to work out exactly what I did that made it break :)

  • @Gordon,
    I have in mind from an older response (http://forum.espruino.com/conversations/­498/#comment5713) , that nightly build cannot be used directly for Espruino Board, because of missing Bootloader.
    If this would be fixed, I would like to add a function to espruino_project.js to load from local drive.

  • @JumJum, yes - It's on my list - it was a possibility for today actually :)

    I'm going to try and hack something up that works on a per-commit basis. The plan is to get information on code size, performance and memory usage over time as well.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

LCD White

Posted by Avatar for Harry_T @Harry_T

Actions