Nokia 1202 LCD SPI Problem - Arduino UNO

Hello All,

I recently came into possession of a Nokia 1202 LCD with STE2007 controller (http://www.datasheetdir.com/STE2007+LCD-Drivers-Controllers) so naturally i hooked it up to my arduino uno to see if i could get it to work.

Being my first project with SPI and a proper LCD, it did not work and I cannot figure out why. Points to note ...

  • The STE2007 controller works with 3v3 levels so as a makeshift I fed the output of the arduino pins through a simple resistance voltage divider to get 3v3 level from 5v0
  • It expects 9 bits (data/control + 8 bit payload) and since SPI is limited to 8 bits I wrote my own manual SPI function

My code is :

#define CS_PIN 10
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13
#define LCD_RESET_PIN 9
#define LED_PIN 8

#define write_spi_command(x) write_spi(x, 0);
#define write_spi_data(x) write_spi(x, 1);


void setup()
{
  //set pin directions
  pinMode(CS_PIN, OUTPUT);
  pinMode(MOSI_PIN, OUTPUT);
  pinMode(MISO_PIN, INPUT);
  pinMode(SCK_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  pinMode(LCD_RESET_PIN, OUTPUT);
  
  //disable lcd to start with 
  digitalWrite(CS_PIN, HIGH);
  digitalWrite(MOSI_PIN, LOW);
  digitalWrite(SCK_PIN, LOW);
 
  //turn on the led
  digitalWrite(LED_PIN, HIGH);
  
  //turn on serial debugging
  Serial.begin(9600);
  Serial.println("-----NOKIA 1202 LCD DEMO-----");
  
  //start the lcd
  LCD_init();
  write_spi_data(0xFF);  
  write_spi_data(0xFF);  
  write_spi_data(0xFF);  
}


void loop()
{
  
}

int write_spi(byte payload, byte dc)
{
  //select lcd
  digitalWrite(CS_PIN, LOW);
  
  //write dc bit
  if(dc==0){digitalWrite(MOSI_PIN, LOW);}
  else {digitalWrite(MOSI_PIN, HIGH);}
  digitalWrite(SCK_PIN, HIGH);
  digitalWrite(SCK_PIN, LOW);
  
  //write payload 8 bits
  for(int i=7;i>=0;i--)
  {
      digitalWrite(MOSI_PIN, (payload>>i)&1);
      //toggle clock
      digitalWrite(SCK_PIN, HIGH);
      digitalWrite(SCK_PIN, LOW);
  }
  
  //turn off lcd cs
  digitalWrite(CS_PIN, HIGH);
  Serial.print("Written 9 bits ::: ");
  Serial.print(dc, HEX);
  Serial.println(payload, HEX);
}

void LCD_reset()
{
  digitalWrite(LCD_RESET_PIN, LOW);
  delay(5);
  digitalWrite(LCD_RESET_PIN, HIGH);
  delay(5);
  Serial.println("\nLCD Hardware Reset Complete");
}

void LCD_init()
{
  LCD_reset();
  write_spi_command(0xE2);  //reset
  delay(10);
  write_spi_command(0xA4);  //power save off
  write_spi_command(0x2F);  //power control set
  write_spi_command(0xB0);  //set page address
  write_spi_command(0x10);  //set col=0 upper 3 bits
  write_spi_command(0x00);  //set col=0 lower 4 bits
  
  write_spi_command(0xAF);  //lcd display on
  Serial.println("\nLCD Init Complete");
}

My serial output prints everything okay so i know the functions are getting executed properly yet i dont see anything on the LCD. any ideas? I am not sure at this point if its the display controller initialization that's not right or my SPI function ....

Thank you,
ankit

Hi

The controller STE2007 seems to be compatible with the ST7565 controller. So maybe u8glib will work:
http://code.google.com/p/u8glib/wiki/device

Usually such displays require a much longer init sequence (I miss the charge pump setup in your code). Indeed, i have seen that different displays require different setup sequence. U8glib has included four different setups for four different display types with the same ST7565 controller:
So maybe one of the u8glib devices for the ST7565 is working for you. While testing u8glib may also need to change dimensions manually in the .c code of the corresponding device.

I would create an official Nokia 1202 device for u8glib if one of the ST7565 devices works, so that others can also use this display directly.

Note: U8glib requires 4 lines 8 Bit mode and expects a corresponding setup.

Oliver

olikraus:
Hi

The controller STE2007 seems to be compatible with the ST7565 controller. So maybe u8glib will work:
Google Code Archive - Long-term storage for Google Code Project Hosting.

Usually such displays require a much longer init sequence (I miss the charge pump setup in your code). Indeed, i have seen that different displays require different setup sequence. U8glib has included four different setups for four different display types with the same ST7565 controller:
So maybe one of the u8glib devices for the ST7565 is working for you. While testing u8glib may also need to change dimensions manually in the .c code of the corresponding device.

I would create an official Nokia 1202 device for u8glib if one of the ST7565 devices works, so that others can also use this display directly.

Note: U8glib requires 4 lines 8 Bit mode and expects a corresponding setup.

Oliver

Hmm ... when starting working with this I came across this thread (Cheap Nokia 1202 B/W LCDs) where people got this lcd working with a ucontroller. i just copied their init sequence as they seemed to have success with it.

while going through the datasheet for STE2007, I cannot figure out what these terms mean/their use:

  • Electronic Volume
  • Charge Pump multiple Factor
  • Bias Ratio

By comparing the files from dangerousprototypes.com it seems that some init commands are missing in your code:

	// v--- Likely these aren't needed...And might not be working :P ---v

	lcdSpi(0xef);	// Set refresh rate
	lcdSpi(3);		// 65 Hz
	
	lcdSpi(0x3d);	// Set Charge Pump multiply factor
	lcdSpi(0);		// 5x
	
	lcdSpi(0x36); // Bias ratio 1/4
	
	lcdSpi(0xad);	// set contrast
	lcdSpi(0x20 | 20);	// 20/32
	
	lcdSpi(0xe1);	
	lcdSpi(0);

I would at least try these commands. The charge pump controlls the on board voltage multiplier for the display. It is difficult to predict the exact value here, but for sure the LCD needs a much higher voltage than the arduino can provide.

Oliver