CFA-635 and Ubuntu

atmelino

New member
I compiled the example and connected my new CFA-635 to my laptop running Ubuntu 10.04 with the parameters

example-635 /dev/ttyUSB0 115200

and it ran without any problems.

Next, I tried the program on Ubuntu 12.04 with the same commands and got:

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

After trying different things, I finally figured out that I it worked once I ran it as superuser:

sudo example-635 /dev/ttyUSB0 115200

I have no idea what causes the different behavior. I'll post if I find out whether there is a way to run it as a regular user on Ubuntu 12.04.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

starlon

New member
scott@scott:Downloads$ ls -lsh /dev/ttyUSB*
0 crw-rw---- 1 root dialout 188, 0 2012-07-01 12:53 /dev/ttyUSB0
0 crw-rw---- 1 root dialout 188, 1 2012-07-01 12:53 /dev/ttyUSB1

Add yourself to the 'dialout' group, or whatever it is on 12.04. Use 'ls' like I have to make sure 'dialout' is correct.
 
USB LCD Displays - Graphic and Character LCDs with a Keypad

atmelino

New member
Thanks for all the help. Perhaps it worked on one of the computers because I had previously installed the Arduino IDE, which prompts you to add yourself to the dialout group.

Meanwhile, an observation I'd like to share:
The example at http://www.crystalfontz.com/product/linux_cli_examples contains the loop

for (k = 0; k <= 10000; k++)
if (check_for_packet()) {
ShowReceivedPacket();
timed_out = 0; //set timed_out to false
break;
}

to read in all outstanding packets before continuing. I am sending four print requests to the device (four LCD lines.) On my laptop, two of the packets are caught in this loop, two other packets are not read unitl the loop at the end of example-635.c:
printf("Updated display, now waiting for packets\n\n");

while (!cleardisplay) {
usleep(100000); // 1/10 second
if (check_for_packet())
ShowReceivedPacket();
}

When I change the loop to
for (k = 0; k <= 100000; k++)
then all of the packerts are read immediately after printing.
I've had the device get stuck a few times, not responding to further requests. I think it may help to put an explicit timer into that loop because currently, the wait time depends upon the computer speed.
 
Top