This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Educational Boosterpack - LCD Issue

Other Parts Discussed in Thread: TEST, ENERGIA

I recently received the Educational Boosterpack (BP-EDUC-01, Rev A2).

I have everything working (RGB, Mic, Potentiometer, ADXL Accelerometer, Buzzer, ....)    EXCEPT   for the LCD (uses a ST7032 controller).

Per the docs, it appears to be a 4-wire SPI interface, and I am using the SPI hardware, but no joy. Scope shows valid SPI output traffic, RS is toggling as required, but the LCD just sits and does nothing. There is no sample code to validate against, so I am kind of stuck at this point.

I've used the same SPI support to talk successfully to other SPI serial LCDs in the past (ala 43oh's serial LCD), so I know the SPI UCB0CLK and UCB0SOMI part of the logic is working. Also added extra delays in, just in case it was a timing thing. Initialization logic is written exactly as documented in ST7032's datasheet.

Has anyone else tried to program this thing, and/or have sample code or tips to share ? 

  • On the LCD side, while it seems to be an SPI connection, usually somw more signals are required for proper operation. This includes the reset line and maybe even command/data selector signal. In too many cases, teh so-called SPI was jsut a serialized parallel input and all other signals of the parallel mdoe where still required.

    Also, keep an eye on the timings. Such as minimum resetsignal time, minimum delay between reset and first command etc. LCD controllers are the worst examples I've ever seen for implementing simple standards like SPI.

  • Hello,

    I too purchased the Educational BoosterPack (BP-EDUC-01, Rev A2) primarily for the display and to learn more about the MSP430 and C coding.  I was surprised that there are very few software examples, and no LCD examples.  What does Circuitco use to test these units?  I have experience in writing assemble for Microchip micros but the MSP430, C code, SPI, and Energia are all new to me.  Using Energia, I copied the LCD Initialization Example Program from the Newhaven Display datasheet (NHD-C0216CZ-NSW-BBW-3V3) and had no luck getting it to work.  I added several time delays and still had no indication of anything from the LCD other than the backlight working.  The next day, I connected my logic analyzer and all the signals looked great.  I tried setting the contrast at both extremes and yet no response on the LCD.  Today I moved the logic analyzer probes directly to the LCD contacts and when I plugged the USB in, the LCD immediately display characters.

    I suspect bad/cold solder joints and will inspect and touchup later using solder with real lead.  As I could not find any example LCD software, here is my Energia code.

    /*
        Educational BoosterPack LCD test using Newhaven Display example SW
        Danny Whitson,  2013-01-25
    */
       
    int whiteledPin = 13;                 // LED connected to digital pin 13
    int RS = 11;                          // Register Select
    int SI = 15;                          // Serial data Input
    int SCL = 7;                          // Serial data CLock
    int serialcounter = 0;
    int charcounter = 0;

    void setup() {                        // initialize the LCD
      pinMode(whiteledPin, OUTPUT);
      pinMode(RS, OUTPUT);
      pinMode(SI, OUTPUT);
      pinMode(SCL, OUTPUT);
      delay(10);
      writecom(0x30);                     // wake up
      // delay(1);
      writecom(0x30);                     // wake up
      writecom(0x30);                     // wake up
      writecom(0x39);                     // function set
      writecom(0x14);                     // internal osc frequency
      writecom(0x70);                     // contrast 
      writecom(0x56);                     // power control
      writecom(0x6D);                     // follower control
      delay(10);
      writecom(0x0C);                     // display on
      writecom(0x01);                     // clear
      delay(5); 
      writecom(0x06);                     // entry mode
      delay(10);
    }

    void loop() {
      for(charcounter = 16; charcounter <= 256; charcounter++) {
      digitalWrite(whiteledPin, HIGH);    // set the LED on
      delay(1);                           // wait 1%
      writedata(charcounter);             // print the char
      digitalWrite(whiteledPin, LOW);     // set the LED on
      delay(99);                          // wait 99%
      }
    }

    void writecom(int d) {
      digitalWrite(RS, LOW);              // A0 = Command
      for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits
      if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)
        digitalWrite(SI, HIGH);           // if 1, then SI=1
      else
        digitalWrite(SI, LOW);            // if 0, then SI=0
        d=(d<<1);                         // shift data byte left
        digitalWrite(SCL, LOW);
        digitalWrite(SCL, HIGH);
        digitalWrite(SCL, LOW);           // SCL
      }
    }

    void writedata(int d) {
      digitalWrite(RS, HIGH);             // A0 = Data
      for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits
      if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)
        digitalWrite(SI, HIGH);           // if 1, then SI=1
      else
        digitalWrite(SI, LOW);            // if 0, then SI=0
        d=(d<<1);                         // shift data byte left
        digitalWrite(SCL, LOW);
        digitalWrite(SCL, HIGH);
        digitalWrite(SCL, LOW);           // SCL
      }
    }

     

  • Danny Whitson said:
    int whiteledPin = 13;                 // LED connected to digital pin 13
    int RS = 11;                          // Register Select
    int SI = 15;                          // Serial data Input
    int SCL = 7;                          // Serial data CLock

     Hi Danny, these var are constant so better coding can be using define or const clause example:

    const int RS = 11;                          // Register Select

    or

    // Register Select

    #define RS 11

     define is a preprocessor clause so string is substituted by, const tell the compiler to store the variable to flash or directly value to code. Probably optimization produce same code but it is more clean use constant to avoid future issue.

  • Hey,

    Thanks for the help, as I am new to C programming and Energia!  In assembly you just bit bang by setting and clearing bits which is fairly easy for simple tasks.  However, not that easy if you need to read a serial temperature sensor like the DS18S20 in degrees C and convert to degrees F and the temperature is below freezing.  I am still working throught the Arduino terms like Shield, Sketch, Fork, Commit, and Blame.  On the C side, I did add "const" to the code as these are indeed constants that don't change and not variables.

    Thanks again for you help, I appreciate it!

  • Hi guys,

     

    Danny Whitson I copied your code made a couple of quick modifications and got it working:

    You may have to press the reset button to start seeing characters.

    Thank you so much for making the code available.  I was not able to find anything from circuitco and started to get disappointed about this boosterpack deal.  Now I am off to try other things:

    Here is your code with the modifications:

    /*

        Educational BoosterPack LCD test using Newhaven Display example SW

        Danny Whitson,  2013-01-25

    */

       

    const int whiteledPin = 13;                 // LED connected to digital pin 13 ** changed to constant Mantoles 01/30/13

    const int RS = 11;                          // Register Select               ** changed to constant Mantoles 01/30/13

    int SI = 15;                          // Serial data Input

    int SCL = 7;                          // Serial data CLock

    int serialcounter = 0;

    int charcounter = 0;

     

    void setup() {                        // initialize the LCD

      pinMode(whiteledPin, OUTPUT);

      pinMode(RS, OUTPUT);

      pinMode(SI, OUTPUT);

      pinMode(SCL, OUTPUT);

      delay(10);

      writecom(0x30);                     // wake up

      delay(1);                           //added delay back.  Mantoles 01/30/13

      writecom(0x30);                     // wake up

      writecom(0x30);                     // wake up

      writecom(0x39);                     // function set

      writecom(0x14);                     // internal osc frequency

      writecom(0x70);                     // contrast 

      writecom(0x56);                     // power control

      writecom(0x6D);                     // follower control

      delay(10);

      writecom(0x0C);                     // display on

      writecom(0x01);                     // clear

      delay(5); 

      writecom(0x06);                     // entry mode

      delay(10);

    }

    void loop()

    {

      for(charcounter = 16; charcounter <= 256; charcounter++)

      {

      digitalWrite(whiteledPin, HIGH);    // set the LED on

      delay(1);                           // wait 1%

      writedata(charcounter);             // print the char

      digitalWrite(whiteledPin, LOW);     // set the LED on

      delay(99);                          // wait 99%

      }

    }

     

    void writecom(int d)

    {

      digitalWrite(RS, LOW);              // A0 = Command

      for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits

      if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)

        digitalWrite(SI, HIGH);           // if 1, then SI=1

      else

        digitalWrite(SI, LOW);            // if 0, then SI=0

        d=(d<<1);                         // shift data byte left

        digitalWrite(SCL, LOW);

        digitalWrite(SCL, HIGH);

        digitalWrite(SCL, LOW);           // SCL

      }

    }

     

    void writedata(int d)

    {

      digitalWrite(RS, HIGH);             // A0 = Data

      for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits

      if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)

        digitalWrite(SI, HIGH);           // if 1, then SI=1

      else

        digitalWrite(SI, LOW);            // if 0, then SI=0

        d=(d<<1);                         // shift data byte left

        digitalWrite(SCL, LOW);

        digitalWrite(SCL, HIGH);

        digitalWrite(SCL, LOW);           // SCL

      }

    }

  • Okay, I have now added a couple of custom LCD characters.  These get loaded into the first two of eight user defined character positions in CGRAM using the following code which replaces the original "void Setup (void)" code.  Note that the bit patterns are shown in binary so the degree symbol and C (degree symbol and F) are seen.

    void setup() {                        // initialize the LCD
      pinMode(whtled, OUTPUT);
      pinMode(RS, OUTPUT);
      pinMode(SI, OUTPUT);
      pinMode(SCL, OUTPUT);
      delay(10);
      writecom(0x30);                        // wake up
      delay(1);
      writecom(0x30);                        // wake up
      writecom(0x30);                        // wake up
      writecom(0x39);                        // function set, IS=1
      writecom(0x14);                        // internal osc frequency
      writecom(0x70);                        // contrast 
      writecom(0x56);                        // power control
      writecom(0x6D);                        // follower control
      delay(10);
      writecom(0x0C);                        // display on

      writecom(0x38);                        // function set, IS=0
      writecom(0x80);                        // set DDRAM addr = 0
      writecom(0x40);                        // set CGRAM addr = 0
      writedata(0b00001000);                  // write bit pattern
      writedata(0b00010100);                  // write bit pattern
      writedata(0b00001000);                  // write bit pattern
      writedata(0b00000111);                  // write bit pattern
      writedata(0b00000100);                  // write bit pattern
      writedata(0b00000100);                  // write bit pattern
      writedata(0b00000100);                  // write bit pattern 
      writedata(0b00000111);                  // write bit pattern 

      writecom(0x38);                        // function set, IS=0
      writecom(0x80);                        // set DDRAM addr = 0
      writecom(0x48);                        // set CGRAM addr = 1
      writedata(0b00001000);                  // write bit pattern
      writedata(0b00010100);                  // write bit pattern
      writedata(0b00001000);                  // write bit pattern
      writedata(0b00000111);                  // write bit pattern
      writedata(0b00000100);                  // write bit pattern
      writedata(0b00000110);                  // write bit pattern
      writedata(0b00000100);                  // write bit pattern 
      writedata(0b00000100);                  // write bit pattern 

      writecom(0x01);                        // clear
      delay(1);  
      writecom(0x06);                        // entry mode
    }

    I am now off to get the MTK3339 GPS to work.  Hyperterm shows that the NMEA data is on COM17 and Earth Bridge only allows selecting COM1 - COM16.

  • Please find a library for the Energia IDE at http://embeddedcomputing.weebly.com/educational-boosterpack.html with three examples.

  • The Educational Boosterpack (BP-EDUC-01) is missing the CSB connection to the LCD display.  The ST7032 controller (buried in the Booster Pack's LCD) is reset only during power-up.  Especially during code development, the ST7032 can easily get out of frame rendering it unable to recognize data.  Add a jumper wire between the CSB pin and a spare pin on J1-3.  Toggling the MSP430's P1.1 during a byte transfer will cause positive registration every byte, and the display works fine.

    Larry

  • I got the lcd program from Danny Whitson to work on the v 1.4 2231 chip.

    I used two proto boards. one for each row of pins.

    Connected all pins on booster pack to equivalent pins on launchpad except RS and Led

    I connected the RS pin 11 on booster to pin 14 on old version 1.4 launchpad.

    Changed energia sketch to reflect that pin change.

    Characters cycle and led flash!!!

    /*

       Educational BoosterPack LCD test using Newhaven Display example SW

       Danny Whitson,  2013-01-25
       Modfied By Tim Mathis--Changed RS and LED connection to work with launchpad v1.4 2231 chip
    */

    const int whiteledPin = 6;                 // LED connected to digital pin 13 ( pin 6 on v1.4 launchpad)

    const int RS = 14;                          // Register Select ( pin 11 on booster to pin 14 on launchpad

    const int SI = 15;                          // Serial data Input

    const int SCL = 7;                          // Serial data CLock

    int serialcounter = 0;

    int charcounter = 0;

    void setup() {                        // initialize the LCD

     pinMode(whiteledPin, OUTPUT);

     pinMode(RS, OUTPUT);

     pinMode(SI, OUTPUT);

     pinMode(SCL, OUTPUT);

     delay(10);

     writecom(0x30);                     // wake up

     // delay(1);

     writecom(0x30);                     // wake up

     writecom(0x30);                     // wake up

     writecom(0x39);                     // function set

     writecom(0x14);                     // internal osc frequency

     writecom(0x70);                     // contrast  

     writecom(0x56);                     // power control

     writecom(0x6D);                     // follower control

     delay(10);

     writecom(0x0C);                     // display on

     writecom(0x01);                     // clear

     delay(5);  

     writecom(0x06);                     // entry mode

     delay(10);

    }

    void loop() {

     for(charcounter = 16; charcounter <= 256; charcounter++) {

     digitalWrite(whiteledPin, HIGH);    // set the LED on

     delay(1);                           // wait 1%

     writedata(charcounter);             // print the char

     digitalWrite(whiteledPin, LOW);     // set the LED on

     delay(99);                          // wait 99%

     }

    }

    void writecom(int d) {

     digitalWrite(RS, LOW);              // A0 = Command

     for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits

     if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)

       digitalWrite(SI, HIGH);           // if 1, then SI=1

     else

       digitalWrite(SI, LOW);            // if 0, then SI=0

       d=(d<<1);                         // shift data byte left

       digitalWrite(SCL, LOW);

       digitalWrite(SCL, HIGH);

       digitalWrite(SCL, LOW);           // SCL

     }

    }

    void writedata(int d) {

     digitalWrite(RS, HIGH);             // A0 = Data

     for(serialcounter = 1; serialcounter <= 8; serialcounter++) {  // send 8 bits

     if((d&0x80)==0x80)                  // get only the Most Significant Bit (MSB)

       digitalWrite(SI, HIGH);           // if 1, then SI=1

     else

       digitalWrite(SI, LOW);            // if 0, then SI=0

       d=(d<<1);                         // shift data byte left

       digitalWrite(SCL, LOW);

       digitalWrite(SCL, HIGH);

       digitalWrite(SCL, LOW);           // SCL

     }

    }

**Attention** This is a public forum