Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a 144 x 32 LCD driven by a ST7920 chip #2091

Open
olikraus opened this issue Feb 3, 2023 · 13 comments
Open

I have a 144 x 32 LCD driven by a ST7920 chip #2091

olikraus opened this issue Feb 3, 2023 · 13 comments
Milestone

Comments

@olikraus
Copy link
Owner

olikraus commented Feb 3, 2023

    I have a 144 x 32 LCD driven by a ST7920 chip. (Tight physical-height requirement, displays is 36mm tall, all the room I have). I've used u8g before, but never had this particular problem: how to specify/set display size in pixels.

There's getDisplayHeight() and getDisplayWidth() methods; are there corresponding set methods?

Or should I just choose a constructor for a differently geometry, eg. 160 x 32, and restrict my horizontal addresses to 144? Eg. U8G2_ST7920_160X32_F_6800(rotation, d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc [, reset]) [full framebuffer, size = 640 bytes]?

SORRY newbie error: somehow clicked POST with incomplete subject line. No way to edit subject nor delete post.

Originally posted by @tomjennings in #2084

@olikraus olikraus changed the title I have a 144 x 32 LCD driven by a ST7920 chip. (Tight physical-height requirement, displays is 36mm tall, all the room I have). I've used u8g before, but never had this particular problem: how to specify/set display size in pixels. I have a 144 x 32 LCD driven by a ST7920 chip Feb 3, 2023
@olikraus olikraus added this to the 2.34 milestone Feb 3, 2023
@craigmoates
Copy link

We also have this 144 x 32 on ST7920 via SW SPI. I've tried to patch in values but have not succeeded yet. I'm looking now on how to rebuild via codebuild, and saw that others also have a need for this new constructor. Thank you!

@olikraus
Copy link
Owner Author

Is this topic still open? Can you do the testing, if I would do the code build changes?

@olikraus olikraus modified the milestones: 2.34, 2.35 Jun 12, 2023
@craigmoates
Copy link

Yes, we should be able to test for this as needed, thank you!

@tomjennings
Copy link

Unfortunately I managed to use a more conventional LCD module and I don't have a good system to check this with. Sorry.

olikraus added a commit that referenced this issue Jun 14, 2023
olikraus added a commit that referenced this issue Jun 14, 2023
@olikraus olikraus modified the milestones: 2.35, 2.34 Jun 14, 2023
olikraus added a commit that referenced this issue Jun 14, 2023
olikraus added a commit that referenced this issue Jun 14, 2023
@olikraus
Copy link
Owner Author

I have created beta 2.34.20 which includes the constructor U8G2_ST7920_144X32...

It would be great if someone could test this.

You can download the latest U8g2 beta release from here: https://github.com/olikraus/U8g2_Arduino/archive/master.zip
Arduino IDE:

  1. Remove the existing U8g2_Arduino library (https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment)
  2. Install the U8g2_Arduino Zip file via Arduino IDE, add zip library menu (https://www.arduino.cc/en/Guide/Libraries).

PlatformIO:
platformio.ini (https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps) should include

lib_deps =
  u8g2=https://github.com/olikraus/U8g2_Arduino/archive/master.zip

@craigmoates
Copy link

craigmoates commented Jun 17, 2023

Tested with several examples but still not working correctly. Let me know what feedback may be helpful. Compiled OK but has same behavior as 160x32 construct it seems. The 144x32 has 18 instead of 20 columns, but other than that they should respond similarly. Here is a code example (tested good): http://baxsie.com/images/forum/Arduino_ST7920_LCD/CFAG14432_SPI_Arduino.zip

@olikraus
Copy link
Owner Author

Which u8g2 code did you use for testing? How will it look on the display? Any picture of the current u8g2 output?

@olikraus olikraus modified the milestones: 2.34, 2.35 Jun 18, 2023
@craigmoates
Copy link

craigmoates commented Jun 18, 2023

Arduino IDE 2.1.0 Mega2560 U8g2_2.34.20 using U8G2_ST7920_144X32_F_SW_SPI, results shown for logo, spacetrash, helloworld, and graphicstest. Ready for other testing as needed.

u8g2_logo_test
u8g2_spacetrash_test
u8g2_helloworld_test

u8g2_test_graphicstest.mp4

@olikraus
Copy link
Owner Author

Thanks for the pics and video.
To me it looks like that there is some noise on the signal lines or some other wiring issue.

@craigmoates
Copy link

The other example which I linked above for your reference works fine, also SW SPI. Here is a video, same setup, just uploaded.

other_example_working.mp4

@olikraus
Copy link
Owner Author

So HW SPI works, but SW SPI doesn't ?

@craigmoates
Copy link

These examples shown, including the working Crystalfontz one above, are SW SPI. No HW SPI here. Here is a section of their code, including bus timing comments:

#define FAST_SPI 1

//FAST_SPI = 0: The SS pin is high for ~429uS (24-bits)
// The clock frequency is ~57KHz
// Full graphic update takes ~285mS
//FAST_SPI = 1: With no delays, the SS pin is high for ~12uS (24-bits)
// The clock frequency is ~2MHz
// But that is too fast for the ST7920, so slow it down
// with the additional _delay_us(1) calls, which makes:
// The SS pin is high for ~39uS (24-bits)
// The clock frequency is ~615KHz
// Full graphic update takes ~22.5mS

//Software SPI (10-bit transfers, difficult to do using the hardware SPI)
#define SPIPORT (PORTB)
#define SPITOGGLE (PINB)

@olikraus olikraus modified the milestones: 2.35, On Hold Aug 24, 2024
@olikraus
Copy link
Owner Author

looks very complicated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants