635 on Fedora 5

jtx

New member
Hi
I have recently purchased the 635 with the mount bracket.
It works very well on windows but now I am putting it to its purpose,display info on my fedora core 5 system

I am having troubles getting the test program to work: It outputs
==================================
Ultra-simple CFA-635 command-line communications example.
Crystalfontz America, Inc. http://www.crystalfontz.com

Usage:
./test635 PORT BAUD
PORT is something like "/dev/ttyS0" or "/dev/usb/ttyUSB0"
BAUD is 19200 or 115200
To clear the display, enter "clear" as an optional third parameter

Serial_Init:: Open() failed
Could not open port "/dev/usb/ttyUSB0" at "115200" baud.


==================================

And LcdProc outputs these:

Could not open driver module server/drivers/CFontzPacket.so: server/drivers/CFontzPacket.so: cannot open shared object file: No such file or directory
Driver [CFontzPacket] binding failed
Could not load driver CFontzPacket
There is no output driver
Critical error while initializing, abort.

==================================
Note that the file above does exist.

Is there any way to get it working? Also, how can I change the contrast and brightness?

Thanks
Jason

------------------------------
Edit: Sorry, my deepest apologies, I stuffed up the location as it was just /dev/usbTTY0. Sorry about that but I still have one question, how do I change contrast ? But I am still getting the binding failed for LCDProc 0.5 which I do not know how to fix
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Last edited:

CF Web

Administrator
Changing the contrast is a matter of sending over the correct command packet, as specified in the 635 data sheet. The linux demo code gives a simple demonstration of packet communication, so modifying the source to change the contrast should be pretty straight forward. You can find the 635 data sheet here: http://www.crystalfontz.com/products/635/635_data_sheet.html

As for the LCDproc question, my best advice is going to be to use the LCDproc mailing list. We don't use it here and can't really offer much in the way of support.


Edit:
Here's a copy/paste from the data sheet on setting the LCD contrast.

13: Set LCD Contrast

This command sets the contrast or vertical viewing angle of the display.

type = 13
valid data_length is 1
data[0] = contrast setting (0-255 valid)
0-65 = very light
66 = light
95 = about right
125 = dark
126-255 = very dark

The return packet will be
:type = 0x40 | 13
data_length = 0
Practical application would be sending a packet with command 31, length 1, and a data value of 120... looking like this in the source:

outgoing_command.command =31;
outgoing_command.data[0]=120;
outgoing_command.data_length=1;
send_packet();
 

IanB

New member
On my FC5 system, the LCD module appears at /dev/ttyUSB0. In /var/log/messages, you're looking for a line that reads something like:

usb 4-2: FTDI USB Serial Device converter now attached to ttyUSB0

The final strng on that line should tell you where it's assigned an entry in the /dev table.

I am slowly writing an alternative application to LCDproc for the 635 on Linux, but recent work and wife constraints have slowed that considerably. :) If you want to rip the code out and use it in your own app, see this thread for some sample packet exchanges. Hopefully everything is fairly sensibly commented and named.

Someone else has written some Linux code (which I haven't tried myself) over at this thread .

Ian.
 

IanB

New member
Oh, one more thing. Did you build LCDproc with the cfontz drivers enabled? Specifically, what values did you pass to the --enable-drivers option on running ./configure? Read the file INSTALL in the root directory of the distro. After building, you should have CFontzPacket.so in the server/drivers subdirectory.

As CF Web says, try the LCDproc forum if that isn't your problem. If that is your problem, you might you find the answer comes back as RTFM. :)

Ian.
 

jtx

New member
Well, I got lcdproc sorted and that I can control contrast, brightness etc.
But how do I set the default ones? Can I just modify the code on the 635 test code to send something that sets it? ThanksJason

BTW, The LCD is really good in my opinion. :)
 

CF Web

Administrator
Unless you sent over a command 4 (which saves the current LCD state as the new boot state), then simply power cycling the LCD module will reset the "default" contrast and brightness states.

If the changed contrast or brightness *did* get saved as the new boot state, then you're just going to have to adjust them until you find the setting that's best for you. Once you tweak it to your liking, you'll have to use command 4 to save the current state as the boot state, which will become your new "default".

If you have windows, you can use the 635 WinTest, located here, to play with the settings and save them as the boot state using a nice, friendly GUI.
 

jtx

New member
Hi
Well, Im very new to these LCD devices
So when I go modify the code in the "635 linux test" how exactly do I use the command 4?

Thanks
Jason
 

jtx

New member
Hi
Firstly, I need to find out how the command '4' is to be used.
And secondly, what is the default factory contrast?

Thanks
 
USB LCD Displays - Graphic and Character LCDs with a Keypad

IanB

New member
jtx said:
Hi
Firstly, I need to find out how the command '4' is to be used.
And secondly, what is the default factory contrast?
I don't know what the default contrast from the factory is, but the manual gives the following values: 0-65 = very light, 66-94 = light, 95 = about right, 96-125 = dark, 126-255 very dark.

To use command 4, setup the screen to appear how you want it on initial startup (see the manual for a full list of exactly what's persisted). Now send a command packet with the following bytes: 0x04 (command number), 0x00 (data length), 0xA4, 0x22 (CRC)

Note that I haven't tried the CRC there - just used a small Perl utility to generate it, so if you get an exception back, you'll need to double-check that value is correct. Sample code for CRC generation is available in the manual.

Ian.
 
Aside from wheather the saved power-on state of the 635's conrast and brightness are in a usefll range ( these should be the same as when you boot windows ) check the Contrast= and Brightness= lines in LCDd.conf.
One of the first things LCDd does when it starts the module is read the LCDd.conf values and set the module to those. These values are in the [driver-name] section of the .conf file.

here is a snip from my file:

Device=/dev/tts/USB0
# Select the LCD type (size) [default: 20x4]
Size=20x4
# Set the initial contrast [default: 140; legal: 0 - 1000]
Contrast=440
# Set the initial brightness [default: 100; legal: 0 - 255]
Brightness=255
 

CF Web

Administrator
I ported our command line scripter over to linux and then made a "return to default" script for the 635.

I have attached the necessary binary and text (script) file in a gzip. All you need to do is unzip and then run the binary using the following format:

./linux_CLS «port» «baud» «script file»

in your case, something like the following:

./linux_CLS /dev/usb/ttyUSB0 115200 CFA635default.txt


This will reset all of the factory defaults and save them as the boot state.

The one caveat is that I did not take the time to change the custom character set in the script file for the Crystalfontz logo on the default boot screen. The result is that, while the text is normal, the logo is an odd set of custom chars. However, this is of little consequence and I'll be changing it in the future.

Edit: The logo will only be different if you changed the custom character set of the lcd.. otherwise, it will show up as normal after the display is reset to it's default boot screen.

If you have more questions, let us know.
 

Attachments

jtx

New member
Hi
I does not work

Here is the output:

./linux_CLS /dev/ttyUSB0 115200 CFA635default.txt
Ultra-simple CFA-631 / CFA-633 / CFA-635 command-line communications example.
Crystalfontz America, Inc. http://www.crystalfontz.com

Usage:
./linux_CLS PORT, BAUD, SCRIPT
PORT is something like "/dev/ttyS0" or "/dev/usb/ttyUSB0"
BAUD is 19200 or 115200
SCRIPT is the filename of the script file, including the path if needed.
Serial_Init:: success
"/dev/ttyUSB0" opened at "115200" baud.

Reading "CFA635default.txt":
Line 1:";CFA-635 Initialization Script File"
Line 2:";"
Line 3:";Format:"
Line 4:"; First four columns is \ccc for the command"
Line 5:"; Next three columns is \lll for the length "
Line 6:";"
Line 7:";A semicolon ";" in column 1 indicates a comment"
Line 8:";"
Line 9:"; **** THIS SCRIPT RESETS ALL OF THE 635 ****"
Line 10:";Read 635 version"
Line 11:"\001\000"
Pkt Rcvd:C=65( 1 = Read Version),L=16,D="CFA635:h1.0,v1.4",CRC=0xBFACA263
Line 12:";Backlight"
Line 13:"\014\001\100"
Pkt Rcvd:C=78(14 = Backlight),L=0,D="",CRC=0xBFACD331
Line 14:";Contrast"
Line 15:"\013\001\120"
Pkt Rcvd:C=77(13 = Contrast),L=0,D="",CRC=0xBFACF959
Line 16:";Cursor Position"
Line 17:"\011\002\000\000"
Pkt Rcvd:C=75(11 = Place Cursor),L=0,D="",CRC=0xBFACAD89
Line 18:";Cursor Style"
Line 19:"\012\001\000"
Pkt Rcvd:C=76(12 = Set Cursor Style),L=0,D="",CRC=0xBFACE081
Line 20:";Set Line 1 Text"
Line 21:"\031\022\000\000Crystalfontz CFA-635"
Pkt Rcvd:C=95(31 = Send Data to LCD (row,col)),L=0,D="",CRC=0xBFAC5F78
Line 22:";Set Line 2 Text"
Line 23:"\031\022\000\001\000\002\004\006 20x4 + keypad &"
Pkt Rcvd:C=95(31 = Send Data to LCD (row,col)),L=0,D="",CRC=0xBFAC5F78
Line 24:";Set Line 3 Text"
Line 25:"\031\022\000\002\001\003\005\007 LEDs in 5\139\034bay"
Pkt Rcvd:C=95(31 = Send Data to LCD (row,col)),L=0,D="",CRC=0xBFAC5F78
Line 26:";Set Line 3 Text"
Line 27:"\031\022\000\003www.crystalfontz.com"
Pkt Rcvd:C=95(31 = Send Data to LCD (row,col)),L=0,D="",CRC=0xBFAC5F78
Line 28:";Fan Power"
Line 29:"\017\004\100\100\100\100"
Pkt Rcvd:C=81(17 = Set Fan Power),L=0,D="",CRC=0xBFACC568
Line 30:";Set Fan RPM Glitch Filter"
Line 31:"\026\004\001\001\001\001"
Pkt Rcvd:C=90(26 = Set Fan RPM Glitch Filter),L=0,D="",CRC=0xBFAC21C0
Line 32:";Configure Key Reporting "
Line 33:"\023\002\063\063 "
Pkt Rcvd:C=87(23 = Set Key Event Reporting),L=0,D="",CRC=0xBFAC91B8
Line 34:";Set ATX Power Switch Functionality"
Line 35:"\028\001\000"
Pkt Rcvd:C=92(28 = Set ATX switch functionality),L=0,D="",CRC=0xBFAC7510
Line 36:";GPIO[0] = J8, Pin 7"
Line 37:"\034\003\000\000\002"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 38:";GPIO[1] = J8, Pin 6 = ATX Host Power Sense"
Line 39:"\034\003\001\000\000"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 40:";GPIO[2] = J8, Pin 5 = ATX Host Power Control"
Line 41:"\034\003\002\000\002"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 42:";GPIO[3] = J8, Pin 4 = ATX Host Reset Control"
Line 43:"\034\003\003\000\002"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 44:";GPIO[4] = J9, Pin 2 = DOW I/O (always has 1K hardware pull-up)"
Line 45:"\034\003\004\100\007"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 46:"; 5 = LG3 = GPIO[5] = P3.0 = LED Green 0"
Line 47:"\034\003\005\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 48:"; 6 = LR3 = GPIO[6] = P3.1 = LED Red 0"
Line 49:"\034\003\006\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 50:"; 7 = LG2 = GPIO[7] = P3.2 = LED Green 1"
Line 51:"\034\003\007\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 52:"; 8 = LR2 = GPIO[8] = P3.3 = LED Red 1"
Line 53:"\034\003\008\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 54:"; 9 = LG1 = GPIO[9] = P3.4 = LED Green 2"
Line 55:"\034\003\009\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 56:";10 = LR1 = GPIO[10] = P3.5 = LED Red 2"
Line 57:"\034\003\010\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 58:";11 = LG0 = GPIO[11] = P3.6 = LED Green 3"
Line 59:"\034\003\011\100\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 60:";12 = LR0 = GPIO[12] = P3.7 = LED Red 3"
Line 61:"\034\003\012\000\005"
Pkt Rcvd:C=98(34 = Set/Configure GPIO),L=0,D="",CRC=0xBFAC59A2
Line 62:";Save current state as boot state"
Line 63:"\004\000"
Pkt Rcvd:C=68( 4 = Store Boot State),L=0,D="",CRC=0xBFAC2E41
Line 64:";Reboot"
Line 65:"\005\003\008\018\099"
Pkt Rcvd:C=69( 5 = Reboot),L=0,D="",CRC=0xBFAC3799
Line 66:";End of CFA-635 initialization script."


Done.

Most of it means nothing to me altough it all had Rcvd.
 

CF Web

Administrator
Actually, the program ran successfully.

The output you posted was the command line scripter program running. Each line starting with "Pkt Rcvd" indicates that a packet was successfully recieved by the LCD. So, in the case of line:
Pkt Rcvd:C=78(14 = Backlight),L=0,D="",CRC=0xBFACD331
the backlight was set correctly. The same goes for the contrast with this line:
Pkt Rcvd:C=77(13 = Contrast),L=0,D="",CRC=0xBFACF959
and at the end, the final saving of all changes to the bootstate with this line:
Pkt Rcvd:C=68( 4 = Store Boot State),L=0,D="",CRC=0xBFAC2E41
Ultimately, the effect of running this script successfully (which it appears that you did) should be that your display is set back to factory default settings.
 

CF Web

Administrator
Nope. The last thing the command line script does is reboot the LCD.. when it comes back up everything should be back to the default settings.
 

jtx

New member
so is there any reason to why it isn't reset? I mean software like LCDProc can have its contrast changed but is never set to default.

Thanks
Jason
 

jtx

New member
Hi
I have retried the reset script.
I was watching the LCD this time when I did it and it restarts(flickered once) and then I see the correct contrast and brightness settings which is good but then almost immediately, the settings go back to the original ones( text is almost invisible not too sure what those settings are)

It is located at /dev/ttyUSB0 and 115200 baud rate when I did the reset script.

How do I find what is causing it to go like this? I know its a very broard question but I would like to have answers if anyone could help. Thanks
Jason
 

jtx

New member
Well, as far as I know and am aware of, it is off.

Im not too sure if any other progs may interfare with the lcd though.

Thanks
Jason
 
Top