MOU-220 problem early in boot

Support for MOC/MOS/MOI/MOU/X-Board/MOP

Moderator: Mods

Post Reply
wirehead
LCD?
Posts: 3
Joined: Thu Feb 02, 2012 2:59 pm

MOU-220 problem early in boot

Post by wirehead »

Hi, folks -

I'm trying to write some text out to this device via the /dev/ttyUSB0 path very early in the boot process of a CentOS Linux system that it's connected to.

I can access the device file, and if I echo some text out to it, it DOES affect the display - but the characters are just gibberish.

I've tried sending straight ASCII, as well as octal sequences corresponding to all writeable characters, and the result is always the same - for each character of any type that I send out to the display, it instead shows -three- gibberish characters (line drawing characters, lightning bolts, various sorts of umlauts, that sort of thing).

I've read through the manual for the screen and I couldn't find anything about a required initialization sequence or anything like that, so I'm a bit lost.

I'm also coming into the game pretty late here since I'm taking over maintaining code from someone who no longer works here and thus isn't available to answer questions about how they originally figured this stuff out.

Help!

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Wirehead,

To ensure you are communicating correctly to your display, first make sure you have the correct baud rate. From there take a look at the more advanced settings.

For an MOU you'll want 8 bits data, No parity, 1 stop bit, with flow control off.

If you continue to have trouble with gibberish characters, just throw up an updated post.

Thanks,
Troy
Troy Clark
Design & Development
Matrix Orbital

wirehead
LCD?
Posts: 3
Joined: Thu Feb 02, 2012 2:59 pm

Post by wirehead »

Hrm... I've been looking, and I can't find any information on setting up a USB port this way. I thought that USB connections were all auto-negotiated?

The LCD works fine once the system is fully booted, so there must be some kind of initialization happening, but I can't find anything in udev or the initscripts that seems to address the lcd directly.

If I query the usb device once the system is up and running, this is what I get:

root@40-61-86-06-60-ef ~ > setserial -a /dev/ttyUSB0
/dev/ttyUSB0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
Baud_base: 24000000, close_delay: 0, divisor: 0
closing_wait: infinte
Flags: spd_normal low_latency

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Wirehead,

Typically the USB drivers will create a virtual serial port, meaning you'll be able to alter any of the serial attributes if need be. I'm not terribly familiar with the implementation in Linux, but you might consider checking out our Linux Appnote for some ideas.

As you continue to work through your code, please remember that the display will have to boot fully before it will successfully display information. You might consider creating a loop at the beginning of your program to query the unit for a successful module number response before starting display tasks.

Thanks,
Troy
Troy Clark
Design & Development
Matrix Orbital

wirehead
LCD?
Posts: 3
Joined: Thu Feb 02, 2012 2:59 pm

Post by wirehead »

Thanks for the quick replies.

I seem to have this working now.

At least on redhat-based distributions, this is what it took, early in rc.sysinit, to get the screen talking to me:


if [ ! -e /dev/ttyUSB0 ]; then
/bin/mknod --mode=660 /dev/ttyUSB0 c 188 0
if [ "$?" -eq "0" ]; then
echo "Successfully created LCD device node."
else
echo "Failed to create LCD device node. "
fi
else
echo "ttyUSB0 already exists."
fi

modprobe ftdi_sio vendor=0x1b3d product=0x0153

if [ "$?" -eq "0" ]; then
echo "Successfully loaded LCD device driver."
else
echo "Failed to load device driver!"
fi

modprobe usbserial vendor=0403 product=fa01
stty -F /dev/ttyUSB0 500:5:cbe:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

It's possible that not all of that is needed, but I'm pretty sure I'd never have figured out the stty stuff without you pointing me in the right direction.

Thanks!

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

No worries Wirehead, great to hear it's all working!
Troy
Troy Clark
Design & Development
Matrix Orbital

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

No worries Wirehead, great to hear it's all working!
Troy
Troy Clark
Design & Development
Matrix Orbital

Post Reply