Page 1 of 1

implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Thu Apr 09, 2015 7:31 pm
by Olli
Hello,

I want to build a DIY RC transmitter.
I have the joysticks, a lot of switches, pushbuttons and a 128x64 pixel LCD with a ST7920 controller inside.
At this moment I have nothing connected to the MEGA2560 except the display.
So I decided to try to change the ST7565 driver in the opentx/radio/src/targets/mega2560 folder to drive the ST7920 display.
the Init is ok and all of the data from the "displayBuf" variable gets transmitted and displayed on the LCD.
But all I can see on the dislay isn't readable.
Can anyone confirm, that my picture is okay for the opentx software?
I had never before a Transmitter with opentx, so I have no experience with that.
I wrote the Data of "displayBuf" in the first row and began with the second row with the next byte from "displayBuf"
row1 = byte0...15
row2= byte 16...31
...
If I get the driver working on my display I will share it here or in the Git Repository for everyone!

Please look over this informations and give me a little hint what is wrong here.
Thank you very much!

best regards

Re: implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Thu Apr 09, 2015 7:52 pm
by MikeB
The two chips address and display the graphic data differently. The ST7565 uses bytes vertically, while the ST7920 uses 16 bit words horizontally.

Mike.

Re: implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Mon Apr 13, 2015 2:04 pm
by Olli
Hello,

thank you very much MikeB for the hint!
Now I found this site:
http://edeca.net/wp/electronics/the-st7 ... ontroller/
The is a explanation of the adresses of the ST7565 Controller.
With this I was able to write a data converter from the "displayBuf" content to the ST7920 Controller of my LCD.
I wrote the driver in the "lcd_driver_ST7565R.cpp" file, so I hadn't nothing to do with the makefile.
Maybe is is possible to add this file with a correct file name to the GIT repository and make it chooseable in tme makefile.

Now I will go on to build my own RC Transmitter.
Thanks for the good software and documentation!

Best regards
Olli

Re: implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Mon May 04, 2015 6:35 am
by vish04
Awesome Olli!
I am stuck with 7290 based display that I purchased from Amazon without knowing what it is. Had a hard time debugging various problems, lot of soldering/desoldering and still no luck. The display would just stay blank.
Then started looking at lcd_driver and realized that the init code was doing something that didn't match with the datasheet and your code here seemed to make more sense. So, I tried it and it works!
I'd totally recommend getting this code merged and checked in with existing driver code.
Thanks!

Re: implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Mon May 04, 2015 6:35 am
by vish04
Awesome Olli!
I am stuck with 7290 based display that I purchased from Amazon without knowing what it is. Had a hard time debugging various problems, lot of soldering/desoldering and still no luck. The display would just stay blank.
Then started looking at lcd_driver and realized that the init code was doing something that didn't match with the datasheet and your code here seemed to make more sense. So, I tried it and it works!
I'd totally recommend getting this code merged and checked in with existing driver code.
Thanks!

Re: implement LCD12864 with ST7920 for MEGA2560 for opentx

Posted: Fri May 15, 2015 7:12 pm
by Olli
Hello,

I forgot to post the necessary changes in "board_mega2560.h"
In the section "LCD driver" the following pins have to be declared:

Code: Select all

// LCD driver
#define PORTA_LCD_DAT         PORTA
#define PORTC_LCD_CTRL        PORTC
#define OUT_C_LCD_E           7
#define OUT_C_LCD_RnW         6
#define OUT_C_LCD_RS          5
#define OUT_C_LCD_RES         4
#define OUT_C_LIGHT           2  
This pins are ususal IO pins without any special function. So they can be changed.
The names are the same on the pcb of the ST7920 LCD.

Best regards
Olli