chipKIT® Development Platform

Inspired by Arduino™

U8g and ST7920 controller and ChipKit

Created Sat, 15 Dec 2012 20:48:00 +0000 by helpme


helpme

Sat, 15 Dec 2012 20:48:00 +0000

I moved from the Arduino Uno R3 to the ChipKit Uno32, U8g library using SPI with 128x64 LCD using ST7920 controller working fine in Arduino, no response at all on ChipKit. ST7920 Operation voltage 2.7V to 5.5V. I checked and rechecked the electrical connections, so I do not suspect them.

First a generic questions:

  1. Anyone successfully using U8g or another library for the ST7920 on ChipKit? If so, details please.

Debugging questions:

  1. How to get debugging information from a library, i.e., Serial object seems to be defined for the 'sketch' and does not seems to be accessible to the library, where would I place the digitalWrite commands to flash a LED to see if communication is actually happening, can I just use pin 13?
  2. Are there big/little Endian issues with constants that could be interpreted as larger than a byte (i.e. 0x0FF) being used as a byte. As far as I can tell uintN_t types have been used throughout, but byte sized constants seem to be defined using three hex digits.

Thanks,

Fred


mkirby

Mon, 17 Dec 2012 23:31:32 +0000

Hello Fred,

The U8g library utilizes Atmel specific code. There is code in that library that talks directly to hardware registers on the chip. The library itself should be compatible if you go in and modify these areas of the code to be their equivalent in the PIC32 world of registers. This is a huge library, so it may take quite a bit of effort to do.

Good Luck, MKirby


helpme

Tue, 18 Dec 2012 00:21:12 +0000

Thanks, That was my thoughts as well, and why I wanted to know if I could use pin 13, i.e. an LED that flashes, as one of the information transfering pins. It turns out that the LED flashes when connecting each wire to pin 13. The data sheet for the ST7920 says that it operates between 2.7V and 5.5V. ????

Also, after writing my post I discovered this post, olikraus Post subject: U8glib: Graphics Lib for LCDs and OLEDs PostPosted: Tue Oct 02, 2012 3:17 pm

It is strange that this post did not show up when I searched for 'U8g'

The only other thing I can think of to try is to put in print statements, but how???

Thanks,

Fred


mkirby

Tue, 18 Dec 2012 00:51:49 +0000

Fred,

You should be able to use that LED (pin 13) for general purpose output if you want, but printing messages would probably be more beneficial for you. For printing messages, MPIDE has a simple Serial interface built in. In your setup() put the following line: Serial.begin(9600); //This sets up UART 1 for default output at a baud rate of 9600

Then whenever you want to print something, just use Serial.print("Stuff"); or Serial.println("Other stuff"); to print whatever you would like to display. Use the serial monitor built into MPIDE to view this output, or any other general purpose Serial Terminal program.

~MKirby


helpme

Tue, 18 Dec 2012 02:14:05 +0000

For the Serial output, the trouble is that the Serial instance is declared in the main file, i.e, the sketch, and does not seem to be globally accessible, i.e., 'Serial not defined in this scope' error message when compiling the library routines.

I generally find that having two pieces of software trying to handle one piece of hardware is asking for trouble, thus I was wonder what form of print statements others use to debug libraries. Do they use some form of extern statement, or comment out the existing declaration of Serial and define an instance of Serial in the library, or ...

Thanks,

Fred


IanJ

Sat, 30 Nov 2013 16:04:53 +0000

Hi,

I am trying to get U8g working with ST7920 also for a project I am upgrading from Arduino 328P........any update on this, really keen to get it working.

Thanks,

Ian.


majenko

Sat, 30 Nov 2013 16:11:41 +0000

I'm not familiar with the ST7920 chipset. How does it compare to the Winstar WG12864A (KS0108)? If it's compatible, then this library is for you: [url]https://sourceforge.net/projects/chipkitglcd/[/url]


helpme

Sat, 30 Nov 2013 21:29:22 +0000

Some things that I found out the hard way:

  1. the U8g library works great with the ST7920 on the ChipKit.
  2. The power to the ST7920 needs to be 5V, The control lines can be 3.3V.
  3. the brightness dial on the ST7920 should be turned all the way bright while testing communications.

hope this helps,

Fred


IanJ

Mon, 02 Dec 2013 22:42:26 +0000

Some things that I found out the hard way:

  1. the U8g library works great with the ST7920 on the ChipKit.
  2. The power to the ST7920 needs to be 5V, The control lines can be 3.3V.
  3. the brightness dial on the ST7920 should be turned all the way bright while testing communications. hope this helps, Fred

Hi Fred, can you offer a few lines of your code......i.e. what pins did you use. My own Arduino code (I'm driving 2off displays actually) is as follows. I've tried changing pins etc but just get a blank display. My voltages are all ok.

U8GLIB_ST7920_128X64 u8g(13, 11, 12);    // SCK, SID, CS (hardware based SPI for LCD2)
U8GLIB_ST7920_128X64_1X u8g2(10, 8, 9);  // SCK, SID, CS (software based SPI for LCD1)

Out of interest, the LCD I am using:-

Ian.


helpme

Mon, 16 Dec 2013 01:14:04 +0000

U8GLIB_ST7920_128X64 u8g(2, 7, 6, U8G_PIN_NONE,5);

Hope this helps,

Fred


bperrybap

Thu, 02 Jan 2014 20:25:26 +0000

I'm not familiar with the ST7920 chipset. How does it compare to the Winstar WG12864A (KS0108)? If it's compatible, then this library is for you: [url]https://sourceforge.net/projects/chipkitglcd/[/url]

Not very. The signals and commands are different and it also suports a serial mode. The biggest issue is that the memory to pixel mapping is horizontal vs vertical.

Although for your library it wouldn't be that bad after a bit of refactoring since after the intialization, the main difference would be the buffer flush.

--- bill