[SOLVED] problems with St7032i 2x16 LCD (IIC)

Working libraries, libraries being ported and related hardware
Post Reply
BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

[SOLVED] problems with St7032i 2x16 LCD (IIC)

Post by BlackBrix » Tue Jan 09, 2018 1:38 pm

(please move into the right forum category if wrong here)

I have to use a 2x16 LCD COG (Chip On Glass) Display with ST7032i IIC driver chip.

Datasheet: http://akizukidenshi.com/download/ds/si ... st7032.pdf
Pics: http://esp8266-projects.org/2015/03/dis ... play-html/

I'm using Rogers core on a STM32F103VE.
at the moment, I am trying and testing with this library: https://github.com/weizenbock/ESP-ST7032
I just inserted here

Code: Select all

//for use of IIC2
TwoWire WIRE2 (2,I2C_FAST_MODE);
#define Wire WIRE2
for using the IIC2 of the MCU.

Everything works fine so far - I can display text and custom symbols - control the contrast - and so on ...
So it seems that the IIC communication is fine,

BUT

something strange happens after (different kinds of) a reset (using hello-world sketch):
- power on the board running through Rogers bootloader first (0x8002000) => in about 25% of all attempts the display starts (shows letters)
- power on the board without any bootloader (0x8000000) => in about 10% of all attempts the display starts (shows letters)
- (automatic) reset after uploading with Rogers bootloader => in about 80% of all attempts the display starts (shows letters)
- (automatic) reset after uploading with STLink => in about 50% of all attempts the display starts (shows letters)

I think something is wrong with the initialization routine of the display,
so that it sometimes "accidentally" works and sometimes not (?)
(as you can see (from my list above) the initialization succeeds more often if the board is already powered)

or may be it is some kind of "race condition" regarding the startup of the IIC or whatever (?)
(variation of the "timing" (the used delay() and delayMicroseconds() -calls) within the initialization routine make no difference)

In any case, the loop() routine is reached - so the SW does not get stuck somewhere in the setup() or the initialization of the LCD..


I have no idea what to do, so I am looking here for some experienced user ;)
Last edited by BlackBrix on Sun Jan 21, 2018 10:59 am, edited 2 times in total.

User avatar
mrburnette
Posts: 2232
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: problems with St7032i 2x16 LCD (IIC)

Post by mrburnette » Tue Jan 09, 2018 2:00 pm

snippet.png
snippet.png (16.59 KiB) Viewed 278 times
The uC likely should control the reset pin on the display. In this manner, your initialization of the display can include any delay() necessary to account for any time the display needs before the uC starts to send initialization commands.

Also, your Vcc may not be stable at the display during processor reboots. Observation with an oscilloscope of Vcc during the power-On / Reset conditions could easily assist with power stability.

The use or non-use of a bootloader on the STM32Fxxx should create no concern other than the delay introduced by the bootloader; that is, the bootloader has the side effect of introducing delay before the user program can begin to run. Often peripherals that need time to stabilize after power is applied are satisfied by the boot-loader delay. If more time is required for a peripheral to become stable, then that time must be introduced into the user code before the device is initialized by code.
displaytest.png
displaytest.png (3.51 KiB) Viewed 278 times
Since your selected display has a test mode, you can do some rough timings to determine what that delay may be.

Ray

BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

Re: problems with St7032i 2x16 LCD (IIC)

Post by BlackBrix » Tue Jan 09, 2018 3:15 pm

mrburnette wrote:
Tue Jan 09, 2018 2:00 pm
The uC likely should control the reset pin on the display
thanks a lot Ray,
I should have mentioned that this is a "given desing":
my "board" contains the MCU and the LCD on one single PCB and I can not (want not) make any HW changes to it.
So the external reset can or should not be used...
(so the LCD uses the "internal Reset" as described on Page 28 of the datasheet)

Another thing:
The original firmware of the board-manufacturer (unfortunately closed source) is obviously able to deal with that very well (not using the external reset),
the display shows up correctly immediately (only some 10th of a second) when power up the board (every single time),
so it has to be possible somehow (even with unstable VCC and other side effects)... :roll:

mrburnette wrote:
Tue Jan 09, 2018 2:00 pm
Since your selected display has a test mode, you can do some rough timings to determine what that delay may be.
This is a COG (Chip On Glass) -controller, so depending on the LCD and the used interface (4-bit, 8-bit, serial,I²C), there are only a few of the controller-pins "on the outside" (of the LCD Glass).
In my case (I²C) it's like this pics show: http://esp8266-projects.org/2015/03/dis ... play-html/
that means: only 8pins are visible (not the mentioned Test-Pins)

zmemw16
Posts: 1687
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: problems with St7032i 2x16 LCD (IIC)

Post by zmemw16 » Tue Jan 09, 2018 3:38 pm

as it seems to reset related, what does the signal on pin 8 do ?
have you a connection to it, maybe to a mcu pin ?
could you add one ?

could you also confirm that all delays are as per the datasheet, if not a fraction longer :D
stephen

BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

Re: problems with St7032i 2x16 LCD (IIC)

Post by BlackBrix » Tue Jan 09, 2018 8:07 pm

aahh, you were right guys. :oops:
It is a reset issue.

I found out that the Pin 8 XRESET was in fact floating instead of being pulled on VDD (as expected by me).
next thing I found is that there is already a track to a MCU-Pin PD7, that I didn't found before when "reverse engineering" this board...
(almost hidden/invisible - on another PCB-layer)

so the rest is easy
insert here before Wire.begin()

Code: Select all

#ifdef EXT_RESET
  pinMode(EXT_RESET_PIN, OUTPUT);
  digitalWrite(EXT_RESET_PIN, LOW);  // low = reset
  delayMicroseconds(100);               // Wait time >100us after external Reset
  digitalWrite(EXT_RESET_PIN, HIGH); // high = normal
#endif

  Wire.begin();
  delay(40);               // Wait time >40ms after VDD stable
and everything works stable :D

zmemw16
Posts: 1687
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: problems with St7032i 2x16 LCD (IIC)

Post by zmemw16 » Tue Jan 09, 2018 8:12 pm

yes :!:sorry :)

Post Reply