Re: Multiple Nokia 5110

by adafruit_support_mike on Fri May 03, 2013 9:43 pm

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by adafruit_support_mike on Sat May 04, 2013 2:02 pm

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by adafruit_support_mike on Sat May 04, 2013 3:26 pm

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 | TOGGLE FULL SIZE
// 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();
}
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by bporter88 on Sun May 05, 2013 3:27 am

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!
bporter88
 
Posts: 9
Joined: Thu Apr 11, 2013 7:20 am

Re: Multiple Nokia 5110

by vinchu on Sun Nov 24, 2013 8:20 pm

Hello!

I wonder if this will also works on Multiple TFTs?

Any pointers ?

Thanks!
vinchu
 
Posts: 1
Joined: Sun Nov 24, 2013 8:09 pm

Re: Multiple Nokia 5110

by adafruit_support_mike on Thu Nov 28, 2013 5:43 am

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by carlos1w on Wed Feb 19, 2014 7:47 pm

is there any way to use hardware SPI on these displays? THe libraries provided (Adafruit_PCD8544) do not appear to support it.
carlos1w
 
Posts: 11
Joined: Tue May 14, 2013 9:35 pm

Re: Multiple Nokia 5110

by adafruit_support_mike on Wed Feb 19, 2014 9:44 pm

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by carlos1w on Tue Apr 22, 2014 10:06 pm

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?
carlos1w
 
Posts: 11
Joined: Tue May 14, 2013 9:35 pm

Re: Multiple Nokia 5110

by adafruit_support_mike on Thu Apr 24, 2014 12:39 am

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
adafruit_support_mike
 
Posts: 9037
Joined: Thu Feb 11, 2010 1:51 pm

Re: Multiple Nokia 5110

by carlos1w on Thu Apr 24, 2014 7:38 am

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.
carlos1w
 
Posts: 11
Joined: Tue May 14, 2013 9:35 pm