Multiple Nokia 5110

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

Just got the extra displays today, and have been distracted by an Eastern European botnet probing my personal network. A friend whose website I host summed that up by saying, "you can't spend as much time as you want reverse-engineering hardware protocols because you're fighting off an attack by Russian robots. You're living an action movie. Welcome to the future Blade Runner!"

.. which, I have to admit, has made me feel better about the whole situation.

My plan is to solder the pin headers onto the new displays tonight and making the basic connections before crashing tonight. With luck, I'll be able to fire up some code and run it through the logic analyzer tomorrow. I'll post an update by midafternoon.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

UPDATE: I've duplicated the problem, and playing around with the timing shows that there's something non-reentrant in the code. There's some code involved in data transfer that uses pointers, so I'm going to dig into that.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

UPDATE 2: Ugh.. If it was a snake it would have bitten me.

the begin() function strobes the RESET pin to make the LCD accept configuration data. Tying the same RESET line to all three displays and calling begin() three times means they all see three RESET pulses. Each new pulse cancels the configuration for the previous display.

To solve the problem, just use a dummy value for the reset pin on all but the first display:

Code: Select all

// pin 3 - LCD reset (RST)
// pin 4 - Data/Command select (D/C)
// pin 5 - Serial data out (DIN)
// pin 6 - Serial clock out (SCLK)
// pin 7 - LCD chip select (CS) for display1
// pin 8 - LCD chip select (CS) for display2
// pin 9 - LCD chip select (CS) for display3
// pin 13 - Not connected to anything.  Absorbs unwanted RST pulses.

Adafruit_PCD8544 display1 = Adafruit_PCD8544(6, 5, 4, 7, 3);
Adafruit_PCD8544 display2 = Adafruit_PCD8544(6, 5, 4, 8, 13);
Adafruit_PCD8544 display3 = Adafruit_PCD8544(6, 5, 4, 9, 13);

void setup()   {
  display1.begin();
  display2.begin();
  display3.begin();

  display1.setContrast(50);
  display2.setContrast(50);
  display3.setContrast(50);

  display1.display();
  display2.display();
  display3.display();
}

bporter88
 
Posts: 9
Joined: Thu Apr 11, 2013 8:20 am

Re: Multiple Nokia 5110

Post by bporter88 »

AAAAHAHAHAAA!!!!!!! IT WORKS!!! Incredible. Thank you so much, I'm very sure I would have never been able to crack that little puzzle. Thanks dude!

vinchu
 
Posts: 1
Joined: Sun Nov 24, 2013 9:09 pm

Re: Multiple Nokia 5110

Post by vinchu »

Hello!

I wonder if this will also works on Multiple TFTs?

Any pointers ?

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

Very unlikely.. TFTs require a lot of memory and some use parallel connections. For those, it's more than just making an SPI connection on a shared bus.

If it was just a matter of SPI communication, you'd probably be able to make multiple displays work that way. In practice you'll need to know exactly what computing resources the display demands from the microcontroller.

User avatar
carlos1w
 
Posts: 13
Joined: Tue May 14, 2013 10:35 pm

Re: Multiple Nokia 5110

Post by carlos1w »

is there any way to use hardware SPI on these displays? THe libraries provided (Adafruit_PCD8544) do not appear to support it.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

The library doesn't have hardware SPI support built in, but modifying the library wouldn't be too hard.

The actual communication is handled in the function 'fastSPIwrite()'. Just modify that to use SPI.transfer(), add the appropriate setup code to the 'begin()' function, and you should be good.

User avatar
carlos1w
 
Posts: 13
Joined: Tue May 14, 2013 10:35 pm

Re: Multiple Nokia 5110

Post by carlos1w »

Thank you, Mike, but I have no idea how to do that. If it is that simple, then perhaps it can be part of a new release of the library in the future?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

Our design constraints are different from those of any specific person who uses our code. We have to keep our libraries general enough for everyone, but small enough to leave people room for their own code. We end up leaning heavily on the principle "good design involves saying 'no' a lot".

We balance that out by releasing our stuff as Open Source/Hardware. Most tech companies don't allow you see or modify their code, so if you want something, you have no choice but to pay them for the features you want. We waive those restrictions, and actively assist people in tweaking our code for their own purposes.

User avatar
carlos1w
 
Posts: 13
Joined: Tue May 14, 2013 10:35 pm

Re: Multiple Nokia 5110

Post by carlos1w »

The idea of using HW SPI rather than bitbanging it is as old as SPI itself. Adafruit has libraries (e.g., the TFT displays') that support both HW and SW SPI. So it is not clear to me why this should not be the case with the Nokia 5110 library too. Unfortunately I am not well versed on library programming, else I'd be happy to modify it myself. Hopefully someone will fork the library.

User avatar
FidgetTheHiker
 
Posts: 5
Joined: Fri Oct 07, 2016 11:14 am

Re: Multiple Nokia 5110

Post by FidgetTheHiker »

I'm trying to wire up two of these Nokia LCD's to an Uno and found this thread helpful. Unfortunately, the two photos that bporter88 uploaded aren't available any longer and I'm not sure how to wire the two LCD's in parallel. I've verified that using pin 2 for the second CS is working - I can use one display with either pin 2 or 4 as CS. Can anyone out there point me to a photo or a diagram that would help?

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Multiple Nokia 5110

Post by adafruit_support_mike »

The connections will be the same as shown in the tutorial for all signals except CS and RST:

https://learn.adafruit.com/nokia-5110-3 ... lcd/wiring

The pins for the CS and RST signals are listed in the code a couple of posts up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”