7 Replies Latest reply on Nov 15, 2013 3:22 AM by JoMe_264151

    char LCD and PSoC 3 trouble

      I'm having a bit of trouble with character LCDs. I have a 2x16 and a 2x24 LCD , both have, or are based off of, the Hitachi 44780 chip. The LCD circuitry is assigned PORT0[1-7] (per  psoc creator 3.0) and both LCDs are brancd new.


      So, I power up the PCB I initialize everything and the LCD starts displaying data ( the PCB also has a heart beat LED).. Ok, we now know the PCB/LCD is ok. However, after some random amount of time the PCB will appear to be hung (heartbeat stoped) and the LCD is no longer showing changes (sometimes incorrect chars are displayed, but not always). If I power off/on the PCB the same thing happens but not always in the same place. If I unplug the LCD cable while the PCB appears hung the heartbeat now works.


      Ok, so I now enable the debugger (Miniprog3) a let it run. Maybe I'll see a buffer overflow or something causing the LCD to shit itself. Nope. Couldn't be that easy. With the debugger enabled and running the PCB never stops (LCD keeps working too).


      To me this now looks like a timing issue, where the debugger slows things down just enough to run propperly. I've tried increaing the delay in LCD_WrDatNib(uint8 nibble) from 1us to as high as 4us, but no help.


      Has anyone had trouble like this?


      Any other suggestions?

        • 1. Re: char LCD and PSoC 3 trouble

          Not sure where to start -




          1) Do you have a schematic you can post ?


          2) Any heat generating components that might be thermal cycling a connection


          on board. Or a part that has a pin or two poorly soldered, subject to heat.


          3) Any part running hot on board, like a regulator, or PSOC ?


          4) Consider posting project for forum to look at.


          5) Using a DSO set to trigger on < Vss, then > Vdd, look at key pins to see


          if you have a transient causing PSOC to go bonkers. If you get latchup


          PSOC would be hot to the touch.




          Regards, Dana.

          • 2. Re: char LCD and PSoC 3 trouble

            1) I'll see what I can do about posting a schamtic. That said, there is nothing special here. Just add a char LCD in the IDE, set to run on P0:[1-7] with a heartbeat LED on P3:0.


            2) No heat generating components. I did think of a poor solder connection and reflowed the PSoC and LCD connector just to be sure (same results).


            3) Nothing running hot.


            4) Basically the project is only doing this...


             main() {


               int num = 0;


               char buf[32];


                timer0_Start();                            // Start timer0 clock (for timer0 INT)
                isr_timer0_Start();                     // Enable timer0 interrupt


                LCD_Start();                            // Initialize and clear the LCD
                CyGlobalIntEnable;               // Enable global interrupts


                while (1) {


            if (timer0int) {   // timer0int is triggered every second.


            sprintf(buf, "Num: %02d", num++);


            LCD_Position(0, 0);




            num = (num > 0x20) ? (0) : (num + 1);








            5) I suppose I'll have to setup my analyzer to look at signal condition.

            • 3. Re: char LCD and PSoC 3 trouble

              Setting the buf[] to all 0x0 before the line


              sprintf(buf, "Num: %02d", num++);


              see if this can help.


              This can be sure you have a NULL terminaled string

              • 4. Re: char LCD and PSoC 3 trouble

                sprintf() when it writes to buff writes a nul terminated string into buf[ ].




                Regards, Dana.

                • 5. Re: char LCD and PSoC 3 trouble

                  To: Dana Good point


                  To cgb.


                  Do you use the ev-kit from Cypress. Or you are using your own board?


                  Have you check the power lines?

                  • 6. Re: char LCD and PSoC 3 trouble

                    The trouble was a bad cable to the LCD. Not sure if it was to long (about 30") or whether there was a bad connection at the headers.  Anyway, I took off one end, cut the ribbon to about 6" and pressed the end back on. PCB (and LCD) have been running now for about 15 minutes and still going (vs a failure within 5 seconds).




                    Thanks for everyone's input!




                    BTW, I had tried "memset(buf, 0, sizeof(buf))" earlier to make sure I wasn't overrunning "buf" with previous data.

                    • 7. Re: char LCD and PSoC 3 trouble

                      that is a bit too long. I would only use no longer that 15-20cm cable.


                      You can check the power supply at the end and also use the scope to check the signal. The signal would be an issue at that length

                      • 8. Re: char LCD and PSoC 3 trouble

                        ... and if you didn't find out for yourself yet: remove the double incrementation of your variable "num".