oscargonzalez/displayshield4d

Autobaud does not work on uLCD-32PT

Opened this issue · 2 comments

Does not work out of the box

Need to modify code to something like


Serial1.begin(9600);  // ONLY INIT @ 9600

        //Copied reset from LIB
        digitalWrite(OLED_RESETPIN, LOW);
    delay(10);                  
    digitalWrite(OLED_RESETPIN, HIGH);
    delay(10); 


    delay(500); //32PT only requires 500ms wait not 1 second
    Serial1.write(0x55);  //Send autobaud


    incomingByte = OLED_NACK;
    while (!Serial1.available()) { delayMicroseconds(50); }
    incomingByte = Serial1.read();

        if (incomingByte = OLED_ACK)  //ACK Recieved ofr Autobaud
        {
          delay(100);

         Serial1.write(0x51); //CMD, Set new BAUD
         Serial1.write(0x0D); //RATE, 115200

           while (!Serial1.available()) { delayMicroseconds(50); }
           incomingByte = Serial1.read();

           if (incomingByte = OLED_ACK)  //BAUD CHANGE OK!
           {
             Serial1.end();  //KILL SERIAL 1
             delay(50); //WAIT A BIT
             Serial1.begin(115000); //START AT 115

           }

        }



If  to Serial1.begin(115200);  it does not work for some reason, anything 
higher than that on this uLCD does not work- maybe I am thick and doing 
something wrong.

But i init the uLCD-32PT  like this and i can draw lines of pixels in the blink 
of an eye.


This lib out of the box does not init the 32PT, also something wierd is 
happening with drawstringblock- the font string, width1 = the whole screen? i 1 
on the whole screen and the rest of the string is gone.

I dont know how to fix it.

Original issue reported on code.google.com by p.stud...@gmail.com on 17 Sep 2011 at 9:04

Since "This command changes the Baud-Rate on the fly.", have you tried changing 
Serial1.begin(115000); *before* waiting for the OLED_ACK?

Have a look at github.com/rei-vilo/Serial_LCD

Original comment by Vilo.Rei on 15 Oct 2011 at 7:26

I use this, works almost seamlessly. The only problem is that reply is always 
0x15, even if action is successful. This has been tested extensively at 115200, 
this rate works perfectly with an arduino mega 2560.

bool Monet::changeBaudRate(BAUDRATES br) {
    //tells the LCD we are going to change baud rate
    _serial->write(GEN_NEWBAUDRATE);
    _serial->write(br);

    bool r = (getReply() == ACK);

    //changes the actual baud rate
    _serial->end();
    delayMicroseconds(100);
    _serial->begin(actual_baudrates[br]);
    delayMicroseconds(100);

    return r;
}
    enum BAUDRATES {
        B110 = 0x00, 
        B300 = 0x01, 
        B600 = 0x02, 
        B1200 = 0x03, 
        B2400 = 0x04, 
        B4800 = 0x05, 
        B9600 = 0x06, 
        B14400 = 0x07, 
        B19200 = 0x08,
        B31250 = 0x09,
        B38400 = 0x0A,      //OK
        B56000 = 0x0B,      //OK
        B57600 = 0x0C,      //OK
        B115200 = 0x0D,     //OK! (max speed to be used with the arduino)
        B128k = 0x0E,       //won't work with the arduino
        B256k = 0x0F};      //won't work with the arduino
const unsigned long Monet::actual_baudrates[] = {110, 300, 600, 1200, 2400, 
4800, 9600, 14400, 19200, 31250, 38400, 56000, 57600, 115200, 128000, 256000};


Original comment by deadbir...@gmail.com on 30 Dec 2011 at 10:59