Problem with MOXA C102 serial board


I’m having a problem to establish communication between QNX 6.2.1 and a SICK LMS laser through a Moxa C102HIS serial board.

Actually I set the board with the following parameters about the ports, after slaying the default devc for serial:
devc-ser8250 -u4 3e8,5 -c 16000000/16

I can establish communication with another PC and send a string of characters using ~1104 bauds, 8n1.
On a terminal on the other PC, I can receive the strings but with slight errors (like the string being in 2 parts, or a wrong character getting into it, or the last one being corrupted).
I cannot establish at all communication with the laser.

I think this may be due to my frequency/divisor settings being not corrects, but I don’t have any more info on this so I don’t really know.

If someone has already used this serial board model or a similar one (16MHz clock) and has an idea, or can explain what exactly is the meaning of the clockrate and the divisor in relation with data transmission, or indicate me some source of documentation, I would be grateful :slight_smile:

Thanks in advance !

Try not having the -c option at all.

The -c clockrate option is to specify a different internal clock frequency than what is commonly used for 8250 type serial controllers. I doubt the driver can acutally set that rate. It’s just to inform the driver on what the hardware is clocked at so it can set the baudrate registers correctly.

The docs say the default is 1843200/16 which equals 115200, sound familiar? Another common number based on this is the original 14.7 MHz crystals used for serial comms. Take a look on the card, you will see a crystal on it somewhere and it’ll be labeled with 14.7MHz or 29.4MHz or maybe even 58.9MHz.

Hmm, reading this,
I get the feeling that setting the clockrate is a good idea. However, you will want to use 8x the default, ie: 14745600/16

That’s rather cool to have the enhanced features available to the standard qnx driver. :slight_smile:

And here’s the C102’s manual if you don’t already have it,

Oh no ! I visited this page actually and I think I just didn’t read the last small line !!! Stupid me !
This is working now, thank you so much ^^

Sorry to make this one bump, but problems are there again !!! ;-)
Now I’m trying to switch my laser to 500k bauds, and it didn’t work too well, probably because of the divisor or something like that.

So I tried to modify again my devc-ser8250 settings again, and my changes do strictly nothing !!!
I don’t understand at all. It didn’t work, so I changed after your advice and it went better. Now I can input any stupid value in the devc_ser8250 -c setting, and it will strictly change nothing !!! Even if I back to my old not-working value.
pidin seems to indicate that the settings have effectively changed, I really don’t understand this time why it doesn’t have any effect on my program !!!

Do you have an idea of what can be happening ? I am starting to think about not using devc-ser8250 anymore… This thing’s weird ! Or is it me ? :slight_smile:

On a side note, the frequency written on the card’s cristal is exactly 16.000000MHz, and setting speed at 1/8 of what I want does not proove to be really accurate, i.e. I don’t get really good results using 1200 bauds instead of 9600, I get the best results using 1150 bauds to communicate with another PC with a standard 1.8MHz card, and 1108 bauds to communicate with the laser, which is sort of confusing… Maybe I would find this funny if not for my supervisor ;-)

Looking messy. There is a whole bunch of possible reasons for your confusion. From not running the binaries you thought you were or wrong options (eg: wrong comport selected) to mistakes in your code to faulty hardware. Or even worse, more than one problem at the same time.

Be wary of sharing an IRQ with a different driver. Some drivers are nasty and leave the IRQ masked for several milliseconds at a time!

Experimenting outside of your application is a good first step for isolating the cause of a problem. I suggest setting up another pc with qnx and maybe even getting a second card. That way you can try different combinations of hardware and software, and also experiment with the baudrates. Another idea is to dig up a storage oscilliscope and verify what your baudrate really is.

PS: There must be another crystal on the card, 16MHz doesn’t make any sense.

Thanks again for your help, I am trying all this atm.
I found this documentation which confuses me even more:

So, for 9600 bauds, not 1200 or 1104, but 1075 ? This documentation is from the laser manufacturer, so I believe it is accurate, but again, no real explanation is given. If I am right, the serial board should divide the frequency by 16 to get baudrates, plus I can add a software divisor (ie 115200 * 16 * 1 = 1.8MHz, max speed for standard serial port).
The 16MHz frequency makes sense to me, as this would mean I should use a divisor 2 to get the 500k bauds speed I want to achieve in the end.

Can you explain why do you think it is not correct ?

“NON-STANDARD” is talking about the 8x speed increase. The -c 14745600/16 option correctly compensates for this so you can expect to get the baudrate you ask for, however there is limits to what rates are possible, read below.

A couple of points I hadn’t thought of earlier …

1: Remember to always slay the old running copy of the driver before trying a new set of settings, ie: slay devc-ser8250
There will be more than one copy of this driver running on a standard install, so slay will ask you to comfirm each one. Kill them all if you aren’t using the built-in comports.

2: Based on the info I have about the 8250 I think 500k is not possible. The possible rates beyond 115k are 132k, 154k, 184k, 230k, 307k, 461k, 922k.

Yes I’ve already become a renowed devc serial killer ;-)
Some MOXA engineers should be spanked for the crystal frequency shown on the board not being the actual one ! Thanks for pointing this out.