A20 - Nokia 3310(pcd8544) Display Library

Started by N8body, March 19, 2014, 12:17:48 AM

Previous topic - Next topic

N8body

Hello

I have completed my work on a Library to drive a Nokia 3310 Display. Code could be found on:
https://github.com/N8body/DisplayC -> Library from Olimex
https://github.com/N8body/BitBang_A20_Python -> Python GPIO Library from Olimex,extended with Bitbang SPI
https://github.com/N8body/pcd8544 -> Python PCD8544

Example:
http://n8body.blogspot.de/2014/03/nokia-display-on-a20.html
Code is still experemental,but maybe someone could use it.

Best Regards
Elias

HenningA

Hey, good idea!

I just did the same, bit bang the SPI to use the Nokia Display. I own two displays with UEXT-Connector from Olimex, so I wanted to use the UEXT-Connector. Therfore I made the pins of UEXT2 available as GPIO Pins (changed the script.fex/bin)and added them to the GPOI-Object in the Python lib.

I implemented the bitbanging in python. So far I can send command and draw single pixels. My next steps would have been to add font support, but now you did this for me ;)

How about merging our code?

Henning

N8body

QuoteI implemented the bitbanging in python
How did you do that? I tried several times,but had problems with the Timings. Instead of writing it in Python i have written it in C and moved it into the Python Library. To be honest,i have forked the Code from the Raspberry Pi Library(https://github.com/rm-hull/pcd8544) and just inserted my "Bitbanging" Stuff. I was to lazy for reinventing the wheel :D
QuoteI own two displays with UEXT-Connector

Yea me too,but without the connector. Theyre lot of cheaper if you buy them without the connector,i got my two for around 4 Euro with free shipping from China. I hope Olimex wouldnt ban me for this hint :D For now i am thinking about buying around 16 Parts and make a "Display-Matrix". The A20 has enough Pins to accomplish this idea,and you can connect CLK on all the Displays.

QuoteHow about merging our code?
Nice Idea,just commit it,i will move it into the "library"


HenningA

QuoteHow did you do that? I tried several times,but had problems with the Timings.

This works here:

def SPIsendByte(byteToSend):
        i = 0
        for i in range(1,9):
                if (byteToSend & 0x80):
                        GPIO.output(GPIO.PIN_PI18, GPIO.HIGH)
                else:
                        GPIO.output(GPIO.PIN_PI18, GPIO.LOW)
                #sleep(0.00001)
                GPIO.output(GPIO.PIN_PI17, GPIO.LOW)
                #sleep(0.00001)
                GPIO.output(GPIO.PIN_PI17, GPIO.HIGH)
                byteToSend = byteToSend << 1


It's derived from the code here:
https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/iMX233/MOD-LCD3310

I just reimplemented the function in python. Delays are not necessary at all. It feels slow, but I don't know if it is because of the python or the bit banging or both.

I'll clean up the my code a little bit in the next days.

QuoteTheyre lot of cheaper if you buy them without the connector,i got my two for around 4 Euro with free shipping from China. I hope Olimex wouldnt ban me for this hint

Hehe, I paid 8€ for the Olimex display, ribbon cable included. But what really sucks is that there is no backlight. The display matrix is a nice idea.

HenningA

Hey,

I've cleaned up the mess a little bit an uploaded it here:
https://github.com/HenningAust/py_LCD

somehow I screwed the git commend  ???

Henning

N8body

Hey

Nice work. I have seen that you have done it by disabling the Hardware SPI and using Software SPI instead.
Why?
I think you can use the Sunxi-Spi Library for using it. http://linux-sunxi.org/SPIdev
I was to lazy for using the UEXT-Header,instead i just connected it to some Pins and then it started working

HenningA

The spidev driver is in the kernel,but it doesn't work (up to now). I did a little bit of research and it seems that it doesn't work on the sun7i / A20 chips. I tried it, but even with correct settings in script.fex and loaded spidev no devices showed up in sys oder dev.

You can find spi-drivers for the sun7i that should work, it is somewhere here in the forum or in the cubieboard forum I think, but that requires buidling a new kernel. I've seen how easy the soft-spi thing is, so i use this as long as the native spi-support is missing. When there is spi-support, i just change the SPIsend funtion. At the moment I don't want to build a new kernel ;)

QuoteI was to lazy for using the UEXT-Header,instead i just connected it to some Pins and then it started working
Same here, I wanted to use UEXT because I just had to plug it in ;)




N8body

QuoteAt the moment I don't want to build a new kernel
Why? Sounds like fun to me. Regarding to this:
http://docs.cubieboard.org/tutorials/dvk521/documentations/a20/driver_porting_and_configuration it shouldnt be
and this:
http://olimex.wordpress.com/2013/09/18/7795/
...it shouldnt be hard. And you can do it on the A20,without "Cross Compiling". You have two 1.2GHz Cores on it,it should do it in some time(havent tested it yet)

HenningA

I made an init-script to start the sysinfo.py at system startup. Is anybody interested in it?

knarfootje


HenningA



arieedzig

Quote from: HenningA on April 12, 2014, 11:10:06 AM
Hi,

I've uploaded the init script and a new README to Github:

https://github.com/HenningAust/py_LCD

Thanks Henning for your code, I forked it and made it compatible with newer version of pyA20SOM and added ip info from wifi interface. Complete how to: http://taqlim.blogspot.com/2014/11/system-info-on-mod-lcd3310-for-olimex.html, git source: https://github.com/arieedzig/py_LCD

HenningA

Hi arieedzig,

it is nice to see that my code is used. I just checked your post. Is it not necessary to change the fex-file for SOM in order to get the SPI-pins to work as gpio or did you miss this in your instructions?

I think right now the native SPI in the kernel should work. I'm going to test this soon. This would make screen update much faster I think.

arieedzig

Quote from: HenningA on November 16, 2014, 10:40:39 AM
Is it not necessary to change the fex-file for SOM in order to get the SPI-pins to work as gpio or did you miss this in your instructions?

Yes, We don't need to change the fex-file in SOM, it was already configured.
I would like to know how to configure it with spi-dev because my SOM spidev device doesn't work anymore with the sample c code. That is why I use your code.