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.

TM4C123 Launchpad GPIO

Other Parts Discussed in Thread: EK-TM4C123GXL

Hi, 

I'm working on interfacing on a 16x2 lcd using tm4c123 launchpad. In the debugging, after sending the characters, the lcd shows nothing. 
I'm using port D  as control port to connect RS & EN. RW is grounded. Data  pins are connected to port B.

To verify the code, I connected 2 leds on RS and EN pin. The leds are glowing whenever we write to the RS and EN pin, so they are working fine. 
After that to check the data pins, I sent a single character and checked the ASCII code on data pins, it's showing correct like I sent character 'A' on data port, ASCII value 65 was verified using the led.  Now if I connect the lcd, it's showing blank. The same lcd if I connect to msp432 launchpad it's working fine.

So what can be the problem.

Thanks and Regards

Praveen Gonsalves

  • Hello Praveen

    Your post lacks two essential details?

    (a) Code
    (b) Information on the LCD panel
  • Hi Amit, 

    I've attached the code. The lcd I'm using is JHD 162A. 

    Thanks and Regards
    Praveen Gonsalves

    LCD Integration.zip

  • Your report of "blank" LCD may indicate that the Lcd's "contrast voltage" is improperly set.   (blank is not an especially good descriptor - you should be able to "just" view the pixel field with the display cleared.)

    I note that you're using Port "D" - that port is (forever) blessed w/pin PD7 being "enslaved" as (universally unwanted) NMI.   Unless you've made SPECIAL EFFORT to FREE PD7 - you will be unable to toggle PD7.   (what you're test likely revealed - was the Lcd's Controller "pulling up" PD7.   (it does that to all data pins)   The "fix" is the unlocking of PD7 (and the exile of the genius who made that obscene decision.)

    ARM MCU is likely faster than your lesser one - thus the timing of the display initialization may be off.  After clearing the Lcd (code 0x01) you must WAIT for nearly 2mS for the display to complete its housekeeping.  

    A better test of "data bus integrity" involves the use of "Walking One or Zero" - which quickly enables the detection of a "stuck" bit or data line.   (Google likely details "Walking One/Zero.")

  • Hello Praveen

    A similar post in the past.... May be a read of the same would be useful

    e2e.ti.com/.../1221915

    Also do note that on the EK-TM4C123GXL PB6 and PB7 are connected to PD0 and PD1. You might want to remove the 0 Ohm resistor or use another set of pins/ports
  • Amit,

    Always dreaded pin "PD7" is "in play" as well. The delightful "NMI" (only & always) continues to plague LOWLY Clients!
  • Hello cb1

    The code does not show PD7. Port D pins 5 and 6 are being used.
  • Yes Amit - that IS true in (this) case. (poster uses Port B as data port.)

    Yet - vendor has long chosen "staus quo" (NMI as default) (far) OVER user's comfort/convenience. And that's the vendor "gift" which keeps on giving!
  • Hi Amit,

    Since the ASCII value is getting transmitted to the data port which has been verified using leds, but is not visible on the lcd.
    Can I say that the lcd is not getting enough current on its data lines to show the characters. Is there any way on increasing current on the gpio port so that lcd can detect signals and show characters.

    Thanks and Regards
    Praveen Gonsalves
  • Hello Praveen,

    Praveen Gonsalves said:
    Since the ASCII value is getting transmitted to the data port which has been verified

    Did you check with a Logic Analyze that the timing of the signals on the bus is being maintained and the data being sent is what the LCD panel expects?

    Praveen Gonsalves said:
    lcd is not getting enough current on its data lines to show the characters

    Normally, that is not the case unless the LCD panel sources its power from data lines which is highly unlikely in this case

    Regards

    Amit

  • As earlier noted here - poster's code FAILS to properly initialize the Lcd.   One major issue appears here:

    void LCDSendCommand(char inCommand)
    {
        #ifdef LCD_4BIT
            GPIOPinWrite(LCD_DATA_PORT, D4 | D5 | D6 | D7, inCommand & 0xF0);
            GPIOPinWrite(LCD_DATA_PORT, RS, 0);   WRONG - should be LCD_Control_Port!
            LCDSendEnable();

            GPIOPinWrite(LCD_DATA_PORT, D4 | D5 | D6 | D7, (inCommand & 0x0F) << 4);
            GPIOPinWrite(LCD_DATA_PORT, RS, 0);
            LCDSendEnable();
        #elif defined(LCD_8BIT)
            GPIOPinWrite(LCD_DATA_PORT, D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7, inCommand);
            GPIOPinWrite(LCD_DATA_PORT, RS, 0);   WRONG - should be LCD_Control_Port!
            LCDSendEnable();
        #endif
    }

    We note that (2nd bold) ONLY the Data_Port is addressed - thus Command Signals RS & E are NOT emitted.  True for (both) 4 & 8 bit data transfers!

    The code to delay targets ONE Second - which is excessive - and is UNLIKELY w/user's MCU.

    There (likely) is more requiring correction - this should give poster a "start."    Attention to detail IS required...

    Poster's fear of "inadequate current" is completely w/out merit.   Timing, timing, timing AND selecting the CORRECT LCD Port ARE (and remain) the issues!

  • Hi Amit,
    I did not check with a Logic Analyze that the timing of the signals on the bus. Is there any way I can check the timing logic using ccs itself

    Thanks and Regards
    Praveen Gonsalves
  • Hi cb1,

    Sorry for uploading the older version of code. I had done that changes, when I verifing the code using leds. RS pin led was never turning on. Then found out this was the issue. Sorry once again, but I've done this changes.

    Thanks and Regards
    Praveen Gonsalves
  • Hello Praveen,

    No you cannot. CCS is code development environment,
  • Uploading (other) than the (most recent, failed) code wastes time, effort - never good.