texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Nokia Pi LCD

Sat Jan 19, 2013 9:08 am

I did use the same, but no - the mosfet needs a high signal to enable the display, so from power up it will not light.

Gastly, the screen is not 'detected' - there is no feedback FROM the display to the Pi, only a serial stream TO the display, plus control lines,
so you can run the code without a display even connected, and it should still run without any errors.
I suspect the problem lies in a dependency, ie something is not installed or configured with your Pi.
Prior to running the code have you installed spidev, etc with

Code: Select all

sudo apt-get install python-imaging python-imaging-tk
sudo apt-get install python-pip
sudo pip install wiringpi
sudo pip install spidev
and modified the blacklist file :
http://www.raspberrypi.org/phpBB3/viewt ... 00#p261609

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Sat Jan 19, 2013 1:14 pm

Looks like the py-spidev and wiringpi are installed since it does make it beyond the import statements. But the blacklist entry has not been removed so the /dev/spidev0.x device can not be opened.

After following the instructions and rebooting, confirm you have the correct /dev entries using 'ls':

Code: Select all

[email protected] ~ $ ls /dev/spidev*
/dev/spidev0.0  /dev/spidev0.1
I use a 2N3904 transistor with a 4.7k ohm base resistor for driving the backlight.

Enjoy!
Bill

gastly
Posts: 2
Joined: Sat Jan 19, 2013 7:28 am

Re: Nokia Pi LCD

Sat Jan 19, 2013 2:50 pm

texy wrote: and modified the blacklist file :
http://www.raspberrypi.org/phpBB3/viewt ... 00#p261609
Wow, thanks you nailed it! That was the problem, the SPI module was blacklisted don't know why it's blacklisted by default though. And the LED's not lighting up at the start was because I hooked the LED's to the SPI pins so it turned on once I ran the script :)

Thanks guys for the help, much appreciated! :)

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Nokia Pi LCD

Sat Jan 19, 2013 11:28 pm

bgreat wrote: CE -- pin 24 (SPI_CE0) or pin 26 (SPI_CE1)
DIN -- pin 19 (SPI_MOSI)
CLK -- pin 23 (SPI_SCLK)
LED -- pin 12 (PWM0) to allow varying the brightness, otherwise any free GPIO
RST -- pin 8, otherwise any free GPIO
DC -- pin 10, otherwise any free GPIO
VCC -- pin 1 (3v3)
GND -- whichever pin is convenient
Hi Bill,

Having installed the required software and loaded the kernel modules, my Adafruit screen lights up but is blank. Looking in your nokiaSPI.py file,

Code: Select all

#gpio's :
DC   = 3 # gpio pin 15 = wiringpi no. 3 (BCM 22)
RST  = 0 # gpio pin 11 = wiringpi no. 0 (BCM 17)
LED  = 1 # gpio pin 12 = wiringpi no. 1 (BCM 18)

# SPI connection
SCE  = 10 # gpio pin 24 = wiringpi no. 10 (CE0 BCM 8)
SCLK = 14 # gpio pin 23 = wiringpi no. 14 (SCLK BCM 11)
DIN  = 12 # gpio pin 19 = wiringpi no. 12 (MOSI BCM 10)
it appears that the pin out should use D/C to GPIO pin 15 and RST to GPIO pin 11, instead of this former pin out. In either case, the screen remains on, but blank. Is there anything else obvious which could be wrong? Your test code (raspiLCD.py) outputs,
  • BMP Load, total time = 0.086
    BMP Load, total time = 0.085
    BMP Load, total time = 0.086
    BMP Load, total time = 0.085
    PIL Image, total time = 0.131
and lsmod returns,
  • Module Size Used by
    snd_bcm2835 12808 1
    snd_pcm 74834 1 snd_bcm2835
    snd_seq 52536 0
    snd_timer 19698 2 snd_seq,snd_pcm
    snd_seq_device 6300 1 snd_seq
    snd 52489 7 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835
    snd_page_alloc 4951 1 snd_pcm
    spidev 5136 0
    i2c_bcm2708 3681 0
    spi_bcm2708 4401 0
Thanks and best regards,

Will

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Nokia Pi LCD

Sat Jan 19, 2013 11:38 pm

Quite possibly you'll have to play with the contrast I think the default for this code is 0x4a Texy used something like 0xbc as default so decimal it is something in a range of 166 to 188 maybe even a bit higher. If you get stuck you could rewire if possible and use his code it works in X and has a contrast slider. Or just try plugging away with 20+ different values in contrast.

Does the screen even dim when you run it when I started the contrast was a pain but I noticed on the first run the screen would dim just a bit that gave me some hope
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Sat Jan 19, 2013 11:58 pm

The pin connection from the code is the expected connection. The output indicates the code is successfully using the SPI interface (it's just the time to build an image and send to the display). The display only receives data and can not respond, so there is no simple way from the code to verify the connection is correct.

You can try dropping the SPI clock rate to 1000000. The default 5000000 may be too fast for some displays. Otherwise, closely check your wiring on both the display and Pi connection.

Also, you could confirm the wiring is ok via an interactive Python session using an LED and resistor.

Enjoy!
Bill

User avatar
tzj
Posts: 302
Joined: Thu Jan 05, 2012 3:09 pm
Location: Barnsley, SY, UK

Re: Nokia Pi LCD

Sun Jan 20, 2013 1:09 am

My contrast was 147 I think, the last time I tested it. But can be as low as 142ish.
http://www.themagpi.com <---- Checkout the MagPi
(The MagPi - Co-Founder)

User avatar
scruss
Posts: 2574
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Nokia Pi LCD

Sun Jan 20, 2013 3:40 am

bgreat wrote:Here is my first cut at turning the original code with additions into a Python class.
Thanks, Bill. That's some nice code. I went and made something spectacularly pointless with it: qrclock - the Quite Rubbish clock. The code and wiring for it is here: The Quite Rubbish Clock. My LCD has yet another variant on the PCD8544 naming scheme:

Code: Select all

 LCD Pin       Function      Pi GPIO Pin #   Pi Pin Name
============= ============= =============== =============
 1 VCC         Vcc            1              3.3 V
 2 GND         Ground        25              GND
 3 SCE         Chip Enable   24              GPIO08 SPI0_CE0_N
 4 RST         Reset         11              GPIO17
 5 D/C         Data/Command  15              GPIO22
 6 DNK(MOSI)   Data In       19              GPIO10 SPI0_MOSI
 7 SCLK        Serial Clock  23              GPIO11 SPI0_SCLK
 8 LED         Backlight     12              GPIO18 PWM0
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Nokia Pi LCD

Sun Jan 20, 2013 9:57 am

Many thanks again to bgreat for the hardware SPI functionality.
For those of you purchasing my Nokia Pi LCD add on board from now on, the module will be reworked to make use of these improvements.
http://www.raspberrypi.org/phpBB3/viewt ... 59&t=14913

Cheers,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Sun Jan 20, 2013 2:56 pm

:oops: Wow! you two are making me blush.

I love the clock! :lol:

Enjoy!
Bill

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Nokia Pi LCD

Sun Jan 20, 2013 11:45 pm

bgreat wrote:The pin connection from the code is the expected connection. The output indicates the code is successfully using the SPI interface (it's just the time to build an image and send to the display). The display only receives data and can not respond, so there is no simple way from the code to verify the connection is correct.

You can try dropping the SPI clock rate to 1000000. The default 5000000 may be too fast for some displays. Otherwise, closely check your wiring on both the display and Pi connection.

Also, you could confirm the wiring is ok via an interactive Python session using an LED and resistor.

Enjoy!
Bill
Hi Bill,

Using the Adafruit board, I have:

Code: Select all

 LCD Pin      Pi GPIO Pin #   Pi Pin Name
============= =============== ===============
 1 GND        6               GND
 2 VCC        1               3.3 V
 3 CLK        23              GPIO11 SPI0_SCLK
 4 DIN        19              GPIO10 SPI0_MOSI
 5 D/C        15              GPIO22
 6 CS         24              GPIO08 SPI0_CE0_N
 7 RST        11              GPIO17
 8 LED        12              GPIO18 PWM0
Texy's wiring Pi based program to print text on the display works after modifying the connection settings to be:

Code: Select all

SCE  = 10 # gpio pin 24 = wiringpi no. 10
SCLK = 14 # gpio pin 23 = wiringpi no. 14
DIN  = 12 # gpio pin 19 = wiringpi no. 12
DC   = 3  # gpio pin 15 = wiringpi no. 3
RST  = 0 # gpio pin 11 = wiringpi no. 0
LED  = 1  # gpio pin 12 = wiringpi no. 1
but running your test program, I still get a blank display even with the slower speed.

Thanks and best regards,

Will

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Mon Jan 21, 2013 12:06 am

I can see no reason for it to not work.

Maybe an issue with the SPI driver. What OS image are you using? I have done all of my testing with the Raspbian Wheezy (2012-12-16) image.

Enjoy!
Bill

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Nokia Pi LCD

Mon Jan 21, 2013 6:37 am

bgreat wrote: Maybe an issue with the SPI driver. What OS image are you using? I have done all of my testing with the Raspbian Wheezy (2012-12-16) image.
Hi Bill,

I'm using the 2012-12-16 Raspbian Wheezy image after all updates. The spidev interface was setup to work with the PiFace (non-root user) as well as root. The Raspberry Pi in question can drive Andrews PiFace examples without issue.

Thanks and best regards,

Will

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Mon Jan 21, 2013 1:24 pm

Same software configuration I am using. I have two displays that are working without issue on my Rev 2 board. I will try my Rev 1 board tonight to see if it works differently.

One more question. How long is the interconnect from the Raspberry Pi to the display? Just so I can try a similar connection.

Enjoy!
Bill

jamiesk
Posts: 95
Joined: Mon Nov 26, 2012 8:48 pm
Location: Ipswich, Suffolk, England, UK.

Re: Nokia Pi LCD

Mon Jan 21, 2013 6:02 pm

Texy.

I got it.
I got it working.
I got to go out to now :(
I need more time to play :)

Thanks.
Keith
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Nokia Pi LCD

Mon Jan 21, 2013 6:45 pm

Enjoy!

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Tue Jan 22, 2013 2:45 am

williamhbell wrote: Texy's wiring Pi based program to print text on the display works after modifying the connection settings to be:

...

but running your test program, I still get a blank display even with the slower speed.
Ok. I've reproduced your issue on another of my Raspberry Pi's. I am still trying to track the root cause, but on my Rev 2 board, the SPI version works and on my Rev 1 board the SPI version does not work.

Enjoy!
Bill

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Tue Jan 22, 2013 3:09 am

Interestingly, the problem is definitely hardware specific. Swapping SD cards between Raspberry Pi's made no difference. My Rev 1 board does not work when using the spidev interface, but works with bit banging. Only other difference is the working system is headless and the non-working system is using HDMI. Still investigating, but this will probably not get any serious attention until the weekend when I have some time.

Any one else out there successfully using hardware SPI on a Rev 1 Raspberry Pi?

Enjoy!
Bill

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Nokia Pi LCD

Tue Jan 22, 2013 3:21 am

I have only been using a Rev 1. board and got it working but have made a change somewhere and now the code only dims and brightens the screen again. My board is the later 256 model and I was playing with this board http://electronics.chroma.se/rpisb.php most the edits at the beginning were already in place and I didn't install minicom.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Tue Jan 22, 2013 3:43 am

Exactly what I am seeing. I thought I had originally tested this on my Rev 1 board, but now it will not work. Tried my prior versions of the code also with the same negative results. I'm wondering if it is an OS or firmware update that broke this. I'm going to go back to an original Raspbian 2012-12-16 and see if it works there.

Let me know if you find a solution.

Thanks and enjoy!
Bill

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Nokia Pi LCD

Tue Jan 22, 2013 11:08 am

bgreat wrote: Any one else out there successfully using hardware SPI on a Rev 1 Raspberry Pi?

Enjoy!
Bill
Yes, but using the py-spidev module I linked to earlier in the thread. Works on revs 1 & 2. Not in this context either, but with dacs and adcs.
Alex Eames RasPi.TV, RasP.iO

User avatar
scruss
Posts: 2574
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Nokia Pi LCD

Tue Jan 22, 2013 12:42 pm

bgreat wrote:Anyone else out there successfully using hardware SPI on a Rev 1 Raspberry Pi?
Yup, my clock demo was on an R1. Raspbian, with all latest updates. The firmware may not quite be the latest — couple or three weeks old, maybe.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Nokia Pi LCD

Tue Jan 22, 2013 1:08 pm

Time to get out the way back machine and see if my Rev 1 works with the un-updated Raspbian.

Thank you for the feedback!

Enjoy!
Bill

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Nokia Pi LCD

Tue Jan 22, 2013 1:50 pm

scruss wrote:
bgreat wrote:Anyone else out there successfully using hardware SPI on a Rev 1 Raspberry Pi?
Yup, my clock demo was on an R1. Raspbian, with all latest updates. The firmware may not quite be the latest — couple or three weeks old, maybe.
And now it's on the front page :D
Alex Eames RasPi.TV, RasP.iO

User avatar
scruss
Posts: 2574
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Nokia Pi LCD

Tue Jan 22, 2013 2:59 pm

alexeames wrote:And now it's on the front page :D
Indeed it is! Bit surprised by that one, but glad people like it. Just as well I didn't post the version that randomly posts QR codes of rude URLs 1% of the time ... ;)
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Python”