View previous topic :: View next topic |
Author |
Message |
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Sun Dec 27, 2020 6:23 pm Post subject: how can I use my OLED display with ST7789v Controller? |
|
|
Is there a library for my OLED Display (320x240 pix) with a controller typ ST7789v?
I want to connect it to an ATMEGA328.
Any idea?
(BASCOM-AVR version : 2.0.8.3 ) |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Dec 28, 2020 11:02 am Post subject: |
|
|
I think Ian is right.
This driver seems to take into account 320 already.
But indeed it need some adjustment.
I think O-Family can best tell. But otherwise i can have a look too since he documented the lib very well. _________________ Mark |
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Mon Dec 28, 2020 2:23 pm Post subject: |
|
|
Hi,
thanks a lot for your help.
Thats exactly what I need.
Greetings from the Black Forest and have a nice day.
Rolf |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Tue Dec 29, 2020 2:35 pm Post subject: |
|
|
The LCD module has various row and column address connections that connect the LCD to the controller.
First of all, please try the ST7789V and ILI9341 libraries posted on the forum and post the displayed image.
I think that will give you advice on modifying the library. |
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Wed Dec 30, 2020 4:38 pm Post subject: |
|
|
I first tested the hardware with a 4x20 character display and the appropriate I2C driver, which works fine. (Circuit see appendix).
With the above mentioned ST7789V driver I unfortunately didn't have any success with the 2.0 inch LCD display, probably because this display is designed for 240x320 pixels.
The display is addressed with the modified example program (see attachment), but only undefined lines result (see picture). Adapting the driver accordingly is beyond my limited knowledge of ATMEGA assembler. It is also not clear to me what I have to change in the Bascom software or in the driver so that I can switch between portrait and landscape mode and 180 ° rotation.
I am grateful for any help. |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Thu Dec 31, 2020 6:37 am Post subject: |
|
|
Looking at the image, it also looks like the LCD initialization or circuit connection is not working properly.
I'm busy with the New Year, so I need some time to find out. |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Mon Jan 04, 2021 3:44 pm Post subject: |
|
|
Hello O-Family,
thanks for your help.
I exchanged the Lib for version 2, recompiled the program and loaded it into the ATMEGA, but nothing has changed in the behavior of the test software. The picture on the display is exactly the same as above.
What I noticed:
the picture appears after power on and does not change.
After a hardware reset on port C.6, the image disappears and the display remains dark.
Actually, as with power on, the picture should appear again. This only happens after power on.
Any idea? |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Tue Jan 05, 2021 3:28 am Post subject: |
|
|
With the same wiring in your schematic and program, it will appear on the 240x240dot LCD I have.
However, my LCD does not have a [CS] pin.
This library is an SPI, not an I2C interface.
Are there any basic wiring mistakes?
If possible, try disconnecting the [CS] connection and fixing it to the [L] or [H] level.
Also note the name of the library.
$lib "glcd-ST7789V_1R3_240x240.lib" |
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Tue Jan 05, 2021 3:16 pm Post subject: |
|
|
Hello O-Family,
after I programmed CS to low-level, the test program works partially.
Text is always displayed without errors.
The graphic sometimes appears complete, but sometimes the program gets stuck in drawing in different stages and the program does not run in a loop.
After a hardware reset, the display remains dark and does not start again.
It seems that the wait cycles are also not executed.
The CPU runs with an internal 8MHz clock.
Another question:
how can I switch between landscape and portrait and rotation? |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Wed Jan 06, 2021 12:50 am Post subject: |
|
|
I'm glad I could check the display for the time being!
The LCD I have doesn't have [CS], but the library itself says [Cs1 = Portb.3] and [CS] moves to the (L) level.
The description of the previous program should be fine.
Code: | Config Graphlcd = Color, A0 = Portd.7, Rst = Portb.4, Si = Portb.1, Sclk = Portb.2, Cs1 = Portb.3 |
Also, [CS] should not be working because [Portb.3] is not output only with the following description.
Or, [CS] will be in an unstable state, so the graphics may behave strangely.
Code: | Config Pind.7 = Output 'DC Display (A0)
Cs Alias Portb.3 'Chip Select (CS)
Reset Cs 'Chip Select low = Display on |
How to change the landscape and portrait is described in my test program.
Code: | Const Portrait = 1 'LCD screen. (0: Landscape [X=240, Y=240], 1: Portrait [X=240, Y=240])
Const Rotate_180 = 0 'LCD screen 180 degree rotation. (0: connector Upper side, 1: connector Lower side) |
Please do your best! |
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Thu Jan 07, 2021 2:02 pm Post subject: |
|
|
Hello O-Family,
many thanks for your support.
I made the changes in the program (see attachments) and everything works fine now.
Reset also works. A fault in the wiring was the cause.
Next question:
How can I switch the display to 240x320 pixels? |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Thu Jan 07, 2021 2:28 pm Post subject: |
|
|
That's good!
Now that we know the LCD connection, let's modify the library so that it can draw at 240x320 pixels.
Please wait as it will take some time. |
|
Back to top |
|
|
dj7th
Joined: 27 Nov 2015 Posts: 14
|
Posted: Thu Jan 07, 2021 3:20 pm Post subject: |
|
|
great. that would help me a lot.
Greetings to Japan from the Black Forest in Germany. |
|
Back to top |
|
|
|