Nokia 3310 LCD Shield v1.0 with Joystick

    The Nokia 3310 LCD is a nice small graphical LCD, suitable for a lot of various projects. 

The display is 38*35 mm, with an active display surface of 30*22 mm, and an  84*48 pixel resolution.

The Nokia 3310 is easy to interface, using standard SPI communication. A small  capacitor from VOUT to GND, is the only external component needed.

Logic supply voltage range VDD to VSS : 2.7 to 3.3 V

Low power consumption, suitable for battery operated systems

Temperature range: -25 to +70 C

    Yeah so far so good; only problem is how to solder the 0.5 mm pins on the Lcd, especially if you're out of practice with the black art of soldering. You would really 

need to etch your own pcb, procure all the necessary components and hope you can get the Lcd to function at the first go.

A better solution would be to purchase a ready made Nokia Lcd 3310 Arduino Shield such as this one from Nuelectronics  and all you need to do is to use jumper-cables

to connect it to the Discovery. In addition to the Lcd the shield comes equipped with a 5-way joystick switch and a reset switch. Both of these switches are brought out

to header pins and they can also be jumper cabled to the Discovery. A nifty 6-led blue backlight is also on board the module and this can be connected too. Altogether

not too bad for around 12 ? The interface to the Discovery takes place over the SPI2 peripheral channel-10 using just the dedicated Mosi and Sclk pins. All of the other 

pins needed are controlled by software. I've successfully used the SPI peripheral onboard both the Avr Mega32 and the Mega168 on numerous occasions and never had 

any problems whatsoever with using it, even when clocked at speeds of upto 10Mhz! Reliable and intuitivly simple to understand were my main impressions of the Avr 

SPI interface and I'd hoped for a repeat of the same with the Stm32 F4. And boy was I wrong! You just have to browse through the Arm forums to realise what a really

complex and versatile beast the Arm SPI peripheral can be. It took me more than a week to finally figure out how to drive the Arm SPI in all its glory and, as usual, 

all credit to the people who helped me to do it! Firstly a warm word of thanks to Peter Harrison  who was able to guide me through the labyrinthian format of the 

Stm32 Standard Peripheral Library; and to his alter ego, Micromouse, whose worked examples were of enormous benefit to me. Likewise I found the Adc3_Dma project 

on the Stm32 Discovery website to be a veritable goldmine of information as to how to configure and use the ADC peripheral. Unlike the example given, which makes

use of the Dma,I chose to use a simple polling routine to read the contents of the Adc, since this demo program should be mainly thought of as a simple proof of concept. 

Nuff said with the introduction, now how does it operate?

    In one word, flawlessly, and that with a 10.5 Mhz Sclk frequency too!  At label ClockInit  the clocks for the GPIOs as well as for the ADC3 and the SPI2 peripherals 

are enabled. The 3 GPIOs used are then configured, followed by the SPI and the ADC. Thereafter the Nokia Lcd is initialised according to the specs in the fairly detailed 

Nulectronic documentation. Please consult the file for further details on how to configure all the peripherals used.


     Arduino Interface Schematic Diagram                                                                                 Discovery Interface Schematic Diagram

    On boot up the processor switches the Blue led on and at label ShieldKey it fetches a 12-Bit analog value from Adc3 according to the following table in Note 6

    Joystick Keys Analog Values 

No Key          = 0x0fff  ->> = 0x0f
Right Key = 0x0b76 ->>    = 0x0b
Up Key   = 0x0810 ->> = 0x08
Down Key = 0x0563 ->>  = 0x05
Centre Key = 0x0244 ->> = 0x02 
Left Key  = 0x0002 ->>  = 0x00


    The digitised analog value is then quasi "filtered" by shifting it right by 8 bits to avoid noise and jitter on the lower bits of the result. If the Joystick wasn't pressed 

the Reset button is then checked, and if no press was detected, the program loops back to ShieldKey. If a key press were to be detected, then the corresponding Bitmap,

String or 32/16/8 bit value is output to the Lcd, and thereafter the switch depression is debounced by the KeyPress routine before once again looping back to ShieldKey

The program is extensively commented and all Key and Lcd routines can easily and transparently be interfaced with your own source code.

The required bitmaps can be easily converted to assembler header files using the wonderful open source FastLcd bitmap converter.

    " I'd put my money on the sun and solar energy. What a source of power! I hope we don't have to wait until oil and coal run out before we tackle that." Thomas Edison