Skip navigation.
Home
The QNX Community Portal

View topic - How to avoid serial data on serial port

How to avoid serial data on serial port

For discussion of realtime and/or embedded programming.

How to avoid serial data on serial port

Postby garyritu » Tue Mar 02, 2010 8:45 am

Hi All,
I am using standard QNX serial driver (devc-ser8250) on embedded device. Embedded device has many controller applications for reading the serial port data. On the bootup of device serial port configurations are done as follows,
for example devc-ser8250 -u1 100,7 -u2 108,7 -u3 110,7 .............
Once driver is up, GPS device is continuously sending data at /dev/ser1 (100) and total CPU consumption of driver becomes ~5 % all time. Even there is no GPS controller application running to read that GPS data. So somehow i need to stop that serial data of GPS device and there should not be CPU consumption.
Also once GPS controller application is running then driver shall respond to application with serial data at port address 100.
I have test following changes on my driver to stop receiving data.

1. devc-ser8250 -u1 100,7 -odisable=rx
2. devc-ser8250 -F -u1 100,7 ( disable the Hardware Flow control)

P.S. : Remember there is no code available for open,close, read, write POSIX api in driver code. So i need to do something using command line option.
garyritu
Active Member
 
Posts: 58
Joined: Fri May 22, 2009 7:09 am

RE: How to avoid serial data on serial port

Postby maschoen » Tue Mar 02, 2010 4:20 pm

I'm not quite sure what you are asking, but have you looked at the stty command?
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Postby garyritu » Tue Mar 02, 2010 5:21 pm

Dear Maschoen,
The basic scenario is as follows,
There are two applications say server (writing data on serial port) and client ( reading data from serial port). Driver is running along with server application, which continuously sending data to port (say every 500 ms)
As per my issue, if client application is not running in system then driver shall ignore data on port till client application is not running. Basically when there is no application for reading the port then driver shall ignore data on port. One way to achieve it is mask the interrupt and unmask the interrupt once open() posix called from client application.
But in case of devc-ser8250 code there is no open() call because everything handled inside the io-char library.
garyritu
Active Member
 
Posts: 58
Joined: Fri May 22, 2009 7:09 am

Postby maschoen » Tue Mar 02, 2010 5:40 pm

I still don't see a question but ... If a client is not running then the driver is effectively ignoring data. It doesn't collect for later. If you don't want the overhead of the interrupt handler running, masking the interrupt is a rather extreme way to go. A more civil approach is to use the RS232 hardware protocol. When no client program has the device open for read, a hardware line controlled by the client system. This of course requires that the server and client's UART's be configured properly.

The way to do this configuration on the QNX side from the command line is the "stty" command.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Postby maschoen » Tue Mar 02, 2010 5:41 pm

BTW: if you mask the interrupt, you disabling data from all devices that use that interrupt. That could be one or many RS232 devices.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Postby garyritu » Thu Mar 04, 2010 12:47 pm

I have tried to use stty utility to disable the h/w flow control. Even wrote a program to setted off the RTS line. Still i am able to get the interrupt on serial port ( verified with watchirq program in QNX). I would like to know is there any way to handle custom devctl commands in devc-ser8250 driver ( it is without resource manager code)???
If possible then using the custom commands, i can disable the interrupt in register of port.
garyritu
Active Member
 
Posts: 58
Joined: Fri May 22, 2009 7:09 am

Postby maschoen » Thu Mar 04, 2010 4:24 pm

garyritu wrote:I have tried to use stty utility to disable the h/w flow control. Even wrote a program to setted off the RTS line. Still i am able to get the interrupt on serial port ( verified with watchirq program in QNX).


Well yes. When the hardware line is toggled there is an interrupt and the driver responds to it. However unless the writing device is not using h/w flow, it should stop sending bytes and that should be the end of it. I'm beginning to think I don't understand why you don't want interrupts.

I would like to know is there any way to handle custom devctl commands in devc-ser8250 driver ( it is without resource manager code)???
If possible then using the custom commands, i can disable the interrupt in register of port.


Well you can always modify the driver source code. It is available. Yes you could add your own custom devctl.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 2 guests