GLK19264A-7T-1U-USB only generates echo after booting

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
markus_a
LCD?
Posts: 4
Joined: Tue Dec 01, 2015 7:56 am

GLK19264A-7T-1U-USB only generates echo after booting

Post by markus_a »

Hi,

I'm writing a small C program to control the display from my CentOS-6-Box. The first command (after setting up the baud rate etc.) sent to the display is "Read Module Type" (0xFE 0x37), so I would expect to get a single byte (0x27) in return.

This works fine when I plug in the display when the computer is running. If the display is connected while the system is booting, I receive two bytes: 0xFE and 0x37. The display has to be unplugged and connected again. After doing this, everything works until the next power cycle.

How can I leave the "echo mode" without manual interaction?

TIA
Markus

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by Daniel Divino »

Hello Markus,

Could you provide a little more information on the situation? I am a little confused regarding some of the details.
If the display is connected while the system is booting, I receive two bytes: 0xFE and 0x37.
When you have the GLK19264A connected to your PC during boot up, does your program attempt to communicate to the device during the boot up? Or does your program wait until your PC and the Display are fully booted to send commands?

-Daniel
Daniel Divino
Technical Support
Matrix Orbital

markus_a
LCD?
Posts: 4
Joined: Tue Dec 01, 2015 7:56 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by markus_a »

Hi Daniel,

for testing the program is started manually, so the booting process should be finished.
Here is an excerpt of the code I am using:

Code: Select all

struct termios term;
int lcd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_SYNC);
term.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD;
term.c_iflag = 0;
term.c_oflag = 0;
term.c_lflag = 0;
tcflush(lcd, TCIOFLUSH);
tcsetattr(lcd,TCSANOW,&term);

char buf[2];
write(lcd, "\xfe\x37", 2);
read(lcd, buf, 1);
write(lcd, "\xfe\x36", 2);
read(lcd, buf+1, 1);
I would expect that buf contains "\x27\x85" and that there are no more bytes to read. But it contains "\xfe\x37" and there are another two bytes available for reading ("\xfe\x36").

It is possible that some kind of automatic hardware detection is talking to the display while booting. Running lsof directly after login shows no process accessing the device. I suspect that the display mistakes the incoming data although I found no command in the manual that would explain this behaviour.

HTH
Markus

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by Daniel Divino »

Hello Markus,

It does seem as if all your device is doing is returning the data you are sending. I am wondering, if you send other commands such as a celar screen "\xfe\x58", does the device properly, or will it just return the command data?
I also wonder if a Software Reset "\xfe\xfd\x4d\x4f\x75\x6e" will be able to fix the issues the display is having once it is booted.

-Daniel
Daniel Divino
Technical Support
Matrix Orbital

markus_a
LCD?
Posts: 4
Joined: Tue Dec 01, 2015 7:56 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by markus_a »

Hi Daniel,

the other commands were echoed as well, but I found an explanation for this. After continuously sending text to the display for about one minute the display went back to normal operation. That suggests that some process during startup sent the echo command (FE FF).

Is there any other chance to leave this command than to send data until nothing is returned?

Markus

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by Daniel Divino »

Hello Markus,

The echo command is supposed to operate by sending FE FF followed by the length of the data you want to be echoed, and the data itself. The only way to end the echo is to send the length of data specified to the display and let it be echoed back. The display isn't supposed to echo anything back until all the data is sent.

Through some testing, I've noticed when you only send the FE FF, with no length, the display locks up, and instead of doing what you tell it to do, it returns the command immediately. Similar to a really angry 8 year old child. The only way to leave this state, in my experience, is to power cycle the display.

What you've described seems like a mix of the two experiences, where as the display will echo any commands sent to it, but will eventually leave echo mode after a certain amount of bits are sent.

I think the best way to stop this is to prevent it from starting. Without knowing what is sending the FE FF bits to the display, you won't know how many bits are expected. You can figure out the specified length by sending the display data and keeping track of how many bits you've sent, and then search through the startup procedure and determine what's sending that command and length in order to confirm it...

OR

You can just lock the display from receiving commands until boot up is complete. By using the "Set and Save Data Lock command" you can lock the display to ensure no inadvertent changes are made. By setting the data lock to 6, your display will lock all commands. Then, once your PC and display are booted up properly, you can set the data lock to 0 to allow for your commands to be used.

All you'll have to do is set the data lock to 0 at the beginning of your code, and then set the data lock to 6 at the end of your code. This should lock your display when your code finishes, and then unlock it again when it runs.

Give the data lock a try and let me know if any issues occur.

-Daniel
Daniel Divino
Technical Support
Matrix Orbital

markus_a
LCD?
Posts: 4
Joined: Tue Dec 01, 2015 7:56 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by markus_a »

HI Daniel,

of course the cleanest way to solve the problem is to prevent any process from talking to the display without knowing what it is doing. But the idea of locking the display while the intended program is not running is a good workaround.

Thanks for your help!
Markus

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: GLK19264A-7T-1U-USB only generates echo after booting

Post by Daniel Divino »

Hello Markus,

I'm glad the work around is sufficient for your needs.

If you have any further troubles, don't hesitate to ask :)

-Daniel
Daniel Divino
Technical Support
Matrix Orbital

Post Reply