Jump to content
43oh

Nokia LCD not working when CS tied to ground? [Solved]


Recommended Posts

I got my LCD working, after fixing some bonehead mistakes (Like setting the main data for loop with I = 8; I < 8, so no data ever got clocked out). Once I wired it up correctly, it shows my image and loops a few strings, clears, everything.

 

But I cannot get it working unless I drive the SCE/CS pin directly. If I tie it to ground, it refuses to start up or anything.

void nokia_init(void)
{
     // Initialize Pins
     P1SEL &= ~SCE & ~RES & ~DC & ~SDIN & ~SCLK;      // Set Needed Pins as GPIO (Part 1)
     P1SEL2 &= ~SCE & ~RES & ~DC & ~SDIN & ~SCLK;     // Set Needed Pins as GPIO (Part 2)
     P1OUT |= SCE | RES | DC | SDIN | SCLK;          // Set Needed Pins to High
     P1DIR |= SCE | RES | DC | SDIN | SCLK;          // Set Needed Pins as Outputs

     // Enable Nokia Display
     DISPLAY_PORT &= ~SCE;		// Set Chip Select Low, Unused

     // Reset LCD
     DISPLAY_PORT |= RES;		// Pull Reset High to Known State, Probably Unneeded
     DISPLAY_PORT &= ~RES;		// Pull Reset Low to Reset LCD
     DISPLAY_PORT |= RES;		// Pull Reset High to Complete Reset

     // Cycle Clock
//     DISPLAY_PORT &= ~SCLK;		// Pull SPI Clock Low
//     DISPLAY_PORT |= SCLK;		// Pull SPI Clock High

     // Disable Nokia Display
     DISPLAY_PORT |= SCE;		// Set Chip Select High
  
     // Setup Nokia Display
     nokia_write( 0x21, SEND_CMD );	// LCD On, H addressing, Ext. Commands.
     nokia_write( 0xBf, SEND_CMD );	// Set LCD VOP (Contrast).
     nokia_write( 0x06, SEND_CMD );	// Set Temp Coefficient to 2.
     nokia_write( 0x13, SEND_CMD );	// LCD Bias Mode 1:48
     nokia_write( 0x20, SEND_CMD );	// LCD On, H addressing, Stnd. Commands.
     nokia_write( 0x08, SEND_CMD );	// LCD Display Blanked.
     nokia_write( 0x0C, SEND_CMD );	// LCD Display Set to Normal Mode.

     nokia_clear(6);			// Clear Screen
}

Can anyone see why it won't work when the SCE line is tied to ground? (attached is the entire project files so far (2x .c, 2x .h).

 

Update: (Solution as per oPossum, add delay between and after, Pulling Reset Pin Low and High)

 

Fridge.zip

Link to post
Share on other sites

Do LCDs like this typically require the CS pin to be used as a "signal" for start-of-command and end-of-data type of stuff?  I always thought they did, i.e. you can't just hold CS low forever and expect the I/O to work right.

From what every source says, (Serdisplib, sparkfun, adafruit) you should be able to. Like a standard SPI device, if it's the only one on the bus, you should be able to tie the CS to ground.

Link to post
Share on other sites

Try adding some delays to reset.

 

    // Reset LCD
     DISPLAY_PORT |= RES;		// Pull Reset High to Known State, Probably Unneeded
     DISPLAY_PORT &= ~RES;		// Pull Reset Low to Reset LCD
     __delay_cycles(100000);
     DISPLAY_PORT |= RES;		// Pull Reset High to Complete Reset
     __delay_cycles(100000);

This did it. I used a smaller delay, but it worked on the first try. Funny, I actually had those delays in it, but due to some wiring and bugs in the code, I had removed them. Ah you know what they say about second guessing yourself. Thanks oPossum.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...