All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] error on rt_dev_read, code Success, what does it mean?
@ 2010-06-12  4:09 Everett Wang
  2010-06-12  9:31 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 11+ messages in thread
From: Everett Wang @ 2010-06-12  4:09 UTC (permalink / raw)
  To: xenomai

Hi,

I am developing a real time programming using xenomai, RTDM. When
I try to read serial port, I sometimes get this message:

error on rt_dev_read, code Success

I checked my program and found that when rt_dev_read returns a
negative number, this message is printed. What does this error message
mean? It seems that my port is open when I tried to read from it.

Thanks in advance,

Everett


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it mean?
  2010-06-12  4:09 [Xenomai-help] error on rt_dev_read, code Success, what does it mean? Everett Wang
@ 2010-06-12  9:31 ` Gilles Chanteperdrix
  2010-06-12 10:13   ` Everett Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Gilles Chanteperdrix @ 2010-06-12  9:31 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

Everett Wang wrote:
> Hi,
> 
> I am developing a real time programming using xenomai, RTDM. When
> I try to read serial port, I sometimes get this message:
> 
> error on rt_dev_read, code Success
> 
> I checked my program and found that when rt_dev_read returns a
> negative number, this message is printed. What does this error message
> mean? It seems that my port is open when I tried to read from it.

It means that you are probably using errno, and since rt_dev_read does
not set errno, you get "Success" as error message instead of the real
error message. If you want to print the real error message, you should
use strerror(-rc) where rc is the return code of rt_dev_read.

But of course, I am just guessing here, seeing your test code would help
more.


-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-12  9:31 ` Gilles Chanteperdrix
@ 2010-06-12 10:13   ` Everett Wang
  2010-06-12 10:45     ` Jan Kiszka
  2010-06-14 14:53     ` Luc ANTOLINOS
  0 siblings, 2 replies; 11+ messages in thread
From: Everett Wang @ 2010-06-12 10:13 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2485 bytes --]

Thanks. I looked my code again, which is modified from example
cross-link.c. The section looks like:

...
                 irq_time = rx_event.rxpend_timestamp;
                read = rt_dev_read(read_fd, &write_time, sz);
                if (read == sz) {
                        read_time = rt_timer_read();
                        printf("%3d |%16llu |%16llu |%16llu\n", nr,
                               irq_time  - write_time,
                               read_time - irq_time,
                               read_time - write_time);
                        nr++;
                } else if (read < 0 ) {
                        printf(RTASK_PREFIX "error on rt_dev_read, code %s\n",
                               strerror(-err)); <<<<<<<===========
                        break;
                } else {
                        printf(RTASK_PREFIX "only %d / %d byte received \n",
                               read, sz);
                        break;
                }
...
I guess I should change the strerror(-err) to strerror(-read). If I do
that, I some
times get a " code input/output error". That is better. What can cause
input/output error? I get my serial port in that state consistently
when I
finish running my GPS program. I can reset it to a usable serial port
again by remove and re-load xeno-16550A module. But setserial -G can't
see anything unusual. Could it be some unclosed serial port?

My simple code is attached.

Thanks,

Everett







On Sat, Jun 12, 2010 at 5:31 PM, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> Everett Wang wrote:
>> Hi,
>>
>> I am developing a real time programming using xenomai, RTDM. When
>> I try to read serial port, I sometimes get this message:
>>
>> error on rt_dev_read, code Success
>>
>> I checked my program and found that when rt_dev_read returns a
>> negative number, this message is printed. What does this error message
>> mean? It seems that my port is open when I tried to read from it.
>
> It means that you are probably using errno, and since rt_dev_read does
> not set errno, you get "Success" as error message instead of the real
> error message. If you want to print the real error message, you should
> use strerror(-rc) where rc is the return code of rt_dev_read.
>
> But of course, I am just guessing here, seeing your test code would help
> more.
>
>
> --
>                                            Gilles.
>

[-- Attachment #2: gps.c --]
[-- Type: text/x-csrc, Size: 4621 bytes --]

/*
 * gps.c
 * Read gps device periodically, compute delay and jittering
 */


#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>

#include <native/task.h>
#include <native/timer.h>

#include <rtdm/rtserial.h>

#define MAIN_PREFIX   "main : "
#define STASK_PREFIX  "gps_task: "

#define GPS_FILE	"rtser0"

#define STATE_FILE_OPENED         1
#define STATE_TASK_CREATED        2

#define SSIZE	450

int gps_fd = -1;

unsigned int gps_state = 0;

/*                           --s-ms-us-ns */
RTIME gps_task_period_ns =    100000000llu;
RT_TASK gps_task;
RTIME trigger_time;

static const struct rtser_config gps_config = {
	.config_mask       = 0xFFFF,
	.baud_rate         = 115200,
	.parity            = RTSER_DEF_PARITY,
	.data_bits         = RTSER_DEF_BITS,
	.stop_bits         = RTSER_DEF_STOPB,
	.handshake         = RTSER_DEF_HAND,
	.fifo_depth        = RTSER_DEF_FIFO_DEPTH,
	.rx_timeout        = 40000000,	/* 40 ms */
	.tx_timeout        = RTSER_DEF_TIMEOUT,
	.event_timeout     = 100000000, /* 0.1 s */
	.timestamp_history = RTSER_RX_TIMESTAMP_HISTORY,
	.event_mask        = RTSER_EVENT_RXPEND,
};

static int close_file( int fd, char *name)
{
	int err, i=0;
	
	do {
		i++;
		err = rt_dev_close(fd);
		switch (err) {
		case -EAGAIN:
			printf(MAIN_PREFIX "%s -> EAGAIN (%d times)\n",
			       name, i);
			rt_task_sleep(50000); /* wait 50us */
			break;
		case 0:
			printf(MAIN_PREFIX "%s -> closed\n", name);
			break;
		default:
			printf(MAIN_PREFIX "%s -> %s\n", name,
			       strerror(-err));
			break;
		}
	} while (err == -EAGAIN && i < 10);

	return err;
}

void cleanup_all(void)
{
	if (gps_state & STATE_FILE_OPENED) {
		close_file(gps_fd, GPS_FILE " (gps)");
		gps_state &= ~STATE_FILE_OPENED;
	}
	
	if (gps_state & STATE_TASK_CREATED) {
		printf(MAIN_PREFIX "delete gps_task\n");
		rt_task_delete(&gps_task);
		gps_state &= ~STATE_TASK_CREATED;
	}
	
}

void catch_signal(int sig)
{
	cleanup_all();
	printf(MAIN_PREFIX "exit\n");
	return;
}

void gps_task_proc(void *arg)
{
	int err, nr = 0;
	ssize_t read = 0;
	char sdata[SSIZE];
	ssize_t ss = SSIZE*sizeof(char);
	RTIME irq_time = 0;
	RTIME read_time = 0;
	RTIME last_time = 0;
	struct rtser_event rx_event;

	while (1) {
 		/* waiting for event */
		err = rt_dev_ioctl(gps_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event);
                if (err) {
                        printf(STASK_PREFIX
                               "error on RTSER_RTIOC_WAIT_EVENT, %s\n",
                               strerror(-err));
                        if (err == -ETIMEDOUT)
                                continue;
                        break;
                }

		irq_time = rx_event.rxpend_timestamp;

		read = rt_dev_read(gps_fd, sdata, ss);
		if (read >= 0) {
			read_time = rt_timer_read();
			printf(STASK_PREFIX "%3d | %3d | %16llu\n", nr, read,
			       irq_time - last_time);
/**
			printf(STASK_PREFIX "%3d | %3d | %16llu\n", nr, read,
			       read_time - irq_time);
			for(i=0;i<read;i++)
				printf("%x ", sdata[i]);
**/
			printf("\n");
		} else {
			printf(STASK_PREFIX "error on rt_dev_read, code %s\n",
			       strerror(-read));
			break;
		}
		last_time = irq_time;

		nr++;
	}

	if ((gps_state & STATE_FILE_OPENED) &&
	    close_file(gps_fd, GPS_FILE " (gps)") == 0)
		gps_state &= ~STATE_FILE_OPENED;

	printf(STASK_PREFIX "exit\n");
}

int main(int argc, char* argv[])
{
	int err = 0;

	signal(SIGTERM, catch_signal);
	signal(SIGINT, catch_signal);

	/* no memory-swapping for this programm */
	mlockall(MCL_CURRENT | MCL_FUTURE);

	/* open rtser0 */
	gps_fd = rt_dev_open( GPS_FILE, 0);
	if (gps_fd < 0) {
		printf(MAIN_PREFIX "can't open %s (gps), %s\n", GPS_FILE,
		       strerror(-gps_fd));
		goto error;
	}
	gps_state |= STATE_FILE_OPENED;
	printf(MAIN_PREFIX "gps-file opened\n");

	/* writing gps-config */
	err = rt_dev_ioctl(gps_fd, RTSER_RTIOC_SET_CONFIG, &gps_config);
	if (err) {
		printf(MAIN_PREFIX "error while RTSER_RTIOC_SET_CONFIG, %s\n",
		       strerror(-err));
		goto error;
	}
	printf(MAIN_PREFIX "gps-config written\n");


	/* create gps_task */
	err = rt_task_create(&gps_task, "gps_task", 0, 50, 0);
	if (err) {
		printf(MAIN_PREFIX "failed to create gps_task, %s\n",
		       strerror(-err));
		goto error;
	}
	gps_state |= STATE_TASK_CREATED;
	printf(MAIN_PREFIX "gps-task created\n");


	/* start gps_task */
	printf(MAIN_PREFIX "starting gps-task\n");
	err = rt_task_start(&gps_task, &gps_task_proc, NULL);
	if (err) {
		printf(MAIN_PREFIX "failed to start gps_task, %s\n",
		       strerror(-err));
		goto error;
	}

	pause();
	return 0;

 error:
	cleanup_all();
	return err;
}


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-12 10:13   ` Everett Wang
@ 2010-06-12 10:45     ` Jan Kiszka
  2010-06-12 17:14       ` Everett Wang
  2010-06-14 14:53     ` Luc ANTOLINOS
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2010-06-12 10:45 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]

Everett Wang wrote:
> Thanks. I looked my code again, which is modified from example
> cross-link.c. The section looks like:
> 
> ...
>                  irq_time = rx_event.rxpend_timestamp;
>                 read = rt_dev_read(read_fd, &write_time, sz);
>                 if (read == sz) {
>                         read_time = rt_timer_read();
>                         printf("%3d |%16llu |%16llu |%16llu\n", nr,
>                                irq_time  - write_time,
>                                read_time - irq_time,
>                                read_time - write_time);
>                         nr++;
>                 } else if (read < 0 ) {
>                         printf(RTASK_PREFIX "error on rt_dev_read, code %s\n",
>                                strerror(-err)); <<<<<<<===========
>                         break;
>                 } else {
>                         printf(RTASK_PREFIX "only %d / %d byte received \n",
>                                read, sz);
>                         break;
>                 }
> ...
> I guess I should change the strerror(-err) to strerror(-read).

Indeed, the example suffers from some copy&paste mistakes. Same for the
write path. And closing in a loop is no longer required. A cleanup is
needed.

> If I do
> that, I some
> times get a " code input/output error". That is better. What can cause
> input/output error?

Try RTSER_RTIOC_GET_STATUS to learn more.

> I get my serial port in that state consistently
> when I
> finish running my GPS program. I can reset it to a usable serial port
> again by remove and re-load xeno-16550A module.

Re-opening the rtser port, ie. restarting your program doesn't help?
Does re-plugging the GPS mouse change the picture? If yes, you may have
to reset its hardware somehow. If no, there might be a sticky state in
our serial driver, ie. a bug.

> But setserial -G can't
> see anything unusual. Could it be some unclosed serial port?
> 
> My simple code is attached.
> 
> Thanks,
> 
> Everett
> 

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it mean?
  2010-06-12 10:45     ` Jan Kiszka
@ 2010-06-12 17:14       ` Everett Wang
  2010-06-14 20:03         ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Everett Wang @ 2010-06-12 17:14 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Sat, Jun 12, 2010 at 6:45 PM, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Everett Wang wrote:
>> Thanks. I looked my code again, which is modified from example
>> cross-link.c. The section looks like:
>>
>> ...
>>                  irq_time = rx_event.rxpend_timestamp;
>>                 read = rt_dev_read(read_fd, &write_time, sz);
>>                 if (read == sz) {
>>                         read_time = rt_timer_read();
>>                         printf("%3d |%16llu |%16llu |%16llu\n", nr,
>>                                irq_time  - write_time,
>>                                read_time - irq_time,
>>                                read_time - write_time);
>>                         nr++;
>>                 } else if (read < 0 ) {
>>                         printf(RTASK_PREFIX "error on rt_dev_read, code %s\n",
>>                                strerror(-err)); <<<<<<<===========
>>                         break;
>>                 } else {
>>                         printf(RTASK_PREFIX "only %d / %d byte received \n",
>>                                read, sz);
>>                         break;
>>                 }
>> ...
>> I guess I should change the strerror(-err) to strerror(-read).
>
> Indeed, the example suffers from some copy&paste mistakes. Same for the
> write path. And closing in a loop is no longer required. A cleanup is
> needed.
>
>> If I do
>> that, I some
>> times get a " code input/output error". That is better. What can cause
>> input/output error?
>
> Try RTSER_RTIOC_GET_STATUS to learn more.

Thanks for answer my questions, I added

err = rt_dev_ioctl(gps_fd,
                        RTSER_RTIOC_GET_STATUS, &serstatus);
printf(STASK_PREFIX "Error code line_status=%d
modem_status=%d\n",serstatus.line_status, serstatus.modem_status);

This prints a message:

gps_task: Error code line_status=98 modem_status=187

Line_status bits are  RTSER_LSR_TRANSM_EMPTY , RTSER_LSR_THR_EMTPY,
RTSER_LSR_OVERRUN_ER

and modem status bits:
 RTSER_MSR_DCD, 	RTSER_MSR_DSR ,RTSER_MSR_CTS, 	RTSER_MSR_DDCD,
RTSER_MSR_DDS, RTSER_MSR_DCTS

Does it caused by "RTSER_LSR_OVERRUN_ER"?
The GPS device outputs upto 450 characters every 0.1 second.

>
>> I get my serial port in that state consistently
>> when I
>> finish running my GPS program. I can reset it to a usable serial port
>> again by remove and re-load xeno-16550A module.
>
> Re-opening the rtser port, ie. restarting your program doesn't help?
> Does re-plugging the GPS mouse change the picture? If yes, you may have
> to reset its hardware somehow. If no, there might be a sticky state in
> our serial driver, ie. a bug.

I can only run my program once without the input/output error.
Subsequenct runs immediately yield an input/output error. The
situation will not go away with remove and reattach power to the GPS
device. But removal of the xeno-16550A.ko module and re-load it
sets the serial port back to usable state.

Without removal and reload module procedure  above, if the GPS power
is off and I run the my program again, it will yield a read timeout
error, which make sense since  gps is not output anything. So it seems
the problem is caused by too many characters being sent to the serial
port from GPS?

Thanks,

Everett
>> But setserial -G can't
>> see anything unusual. Could it be some unclosed serial port?
>>
>> My simple code is attached.
>>
>> Thanks,
>>
>> Everett
>>
>
> Jan
>
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-12 10:13   ` Everett Wang
  2010-06-12 10:45     ` Jan Kiszka
@ 2010-06-14 14:53     ` Luc ANTOLINOS
  2010-06-15  0:45       ` Everett Wang
  1 sibling, 1 reply; 11+ messages in thread
From: Luc ANTOLINOS @ 2010-06-14 14:53 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

On 12 June 2010 12:13, Everett Wang <everteq@domain.hid> wrote:
> get a " code input/output error". That is better. What can cause
> input/output error? I get my serial port in that state consistently
> when I
> finish running my GPS program. I can reset it to a usable serial port
> again by remove and re-load xeno-16550A module. But setserial -G can't
> see anything unusual. Could it be some unclosed serial port?
Hi,
Does this error appear while running or only after exiting (no error
while running the first time after reloading the module) ?

-- 
Luc


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it mean?
  2010-06-12 17:14       ` Everett Wang
@ 2010-06-14 20:03         ` Jan Kiszka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2010-06-14 20:03 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

Everett Wang wrote:
> On Sat, Jun 12, 2010 at 6:45 PM, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>> Everett Wang wrote:
>>> Thanks. I looked my code again, which is modified from example
>>> cross-link.c. The section looks like:
>>>
>>> ...
>>>                  irq_time = rx_event.rxpend_timestamp;
>>>                 read = rt_dev_read(read_fd, &write_time, sz);
>>>                 if (read == sz) {
>>>                         read_time = rt_timer_read();
>>>                         printf("%3d |%16llu |%16llu |%16llu\n", nr,
>>>                                irq_time  - write_time,
>>>                                read_time - irq_time,
>>>                                read_time - write_time);
>>>                         nr++;
>>>                 } else if (read < 0 ) {
>>>                         printf(RTASK_PREFIX "error on rt_dev_read, code %s\n",
>>>                                strerror(-err)); <<<<<<<===========
>>>                         break;
>>>                 } else {
>>>                         printf(RTASK_PREFIX "only %d / %d byte received \n",
>>>                                read, sz);
>>>                         break;
>>>                 }
>>> ...
>>> I guess I should change the strerror(-err) to strerror(-read).
>> Indeed, the example suffers from some copy&paste mistakes. Same for the
>> write path. And closing in a loop is no longer required. A cleanup is
>> needed.
>>
>>> If I do
>>> that, I some
>>> times get a " code input/output error". That is better. What can cause
>>> input/output error?
>> Try RTSER_RTIOC_GET_STATUS to learn more.
> 
> Thanks for answer my questions, I added
> 
> err = rt_dev_ioctl(gps_fd,
>                         RTSER_RTIOC_GET_STATUS, &serstatus);
> printf(STASK_PREFIX "Error code line_status=%d
> modem_status=%d\n",serstatus.line_status, serstatus.modem_status);
> 
> This prints a message:
> 
> gps_task: Error code line_status=98 modem_status=187
> 
> Line_status bits are  RTSER_LSR_TRANSM_EMPTY , RTSER_LSR_THR_EMTPY,
> RTSER_LSR_OVERRUN_ER
> 
> and modem status bits:
>  RTSER_MSR_DCD, 	RTSER_MSR_DSR ,RTSER_MSR_CTS, 	RTSER_MSR_DDCD,
> RTSER_MSR_DDS, RTSER_MSR_DCTS
> 
> Does it caused by "RTSER_LSR_OVERRUN_ER"?
> The GPS device outputs upto 450 characters every 0.1 second.

Looking at your code, you probably want to clear the quickly overflowing
RX queue and pending overflow errors before entering the read loop.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-14 14:53     ` Luc ANTOLINOS
@ 2010-06-15  0:45       ` Everett Wang
  2010-06-15  9:27         ` Luc ANTOLINOS
  0 siblings, 1 reply; 11+ messages in thread
From: Everett Wang @ 2010-06-15  0:45 UTC (permalink / raw)
  To: Luc ANTOLINOS; +Cc: xenomai

Hi,

That is exactly correct. I can run my small program as long as I want, when I
first started my computer and load the module. But after I exit it by
press control-C,
I can't run it successfully. So it could be something my program does when it
exiting that sets the port in a strange state.

Everett

On Mon, Jun 14, 2010 at 10:53 PM, Luc ANTOLINOS <luciogistr@domain.hid> wrote:
> On 12 June 2010 12:13, Everett Wang <everteq@domain.hid> wrote:
>> get a " code input/output error". That is better. What can cause
>> input/output error? I get my serial port in that state consistently
>> when I
>> finish running my GPS program. I can reset it to a usable serial port
>> again by remove and re-load xeno-16550A module. But setserial -G can't
>> see anything unusual. Could it be some unclosed serial port?
> Hi,
> Does this error appear while running or only after exiting (no error
> while running the first time after reloading the module) ?
>
> --
> Luc
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-15  0:45       ` Everett Wang
@ 2010-06-15  9:27         ` Luc ANTOLINOS
  2010-06-17  7:49           ` Everett Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Luc ANTOLINOS @ 2010-06-15  9:27 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

On 15 June 2010 02:45, Everett Wang <everteq@domain.hid> wrote:
> Hi,
>
> That is exactly correct. I can run my small program as long as I want, when I
> first started my computer and load the module. But after I exit it by
> press control-C,
> I can't run it successfully. So it could be something my program does when it
> exiting that sets the port in a strange state.
Hi,
- Just after opening the serial port, can you get the status with
RTSER_RTIOC_GET_STATUS to be sure the uart driver reset the flags (it
should).
- If you purge the read buffer and try again to read (instead of
exiting the program), is the error still here ? Is the error at the
first read or at each read. In the line status bits, you have only
RTSER_LSR_TRANSM_EMPTY , RTSER_LSR_THR_EMTPY,
RTSER_LSR_OVERRUN_ER ? never Software overrun (just to confirm).
- Have to tried to open,read,close 2 times in the same program instead
of killing and running again the program ? You can then determine if
it comes from the opening/closing routines ?
- Can you also test by sending data from another computer for example
(if possible) instead of directly from you GPS. Trying to determine if
the problem is really the uart hardware or just sofware (your code or
driver code).

-- 
Luc


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-15  9:27         ` Luc ANTOLINOS
@ 2010-06-17  7:49           ` Everett Wang
  2010-06-17  8:48             ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Everett Wang @ 2010-06-17  7:49 UTC (permalink / raw)
  To: Luc ANTOLINOS; +Cc: xenomai

Hi Jan and Luc,

Thanks for the helping suggestions. After reading from the manual, I
still have difficult
finding how to clear RX queue and overflow error. Nor how to purge the
read buffer. What are
the functions for these tasks?

Thanks,

Everett



On Tue, Jun 15, 2010 at 5:27 PM, Luc ANTOLINOS <luciogistr@domain.hid> wrote:
> On 15 June 2010 02:45, Everett Wang <everteq@domain.hid> wrote:
>> Hi,
>>
>> That is exactly correct. I can run my small program as long as I want, when I
>> first started my computer and load the module. But after I exit it by
>> press control-C,
>> I can't run it successfully. So it could be something my program does when it
>> exiting that sets the port in a strange state.
> Hi,
> - Just after opening the serial port, can you get the status with
> RTSER_RTIOC_GET_STATUS to be sure the uart driver reset the flags (it
> should).
> - If you purge the read buffer and try again to read (instead of
> exiting the program), is the error still here ? Is the error at the
> first read or at each read. In the line status bits, you have only
> RTSER_LSR_TRANSM_EMPTY , RTSER_LSR_THR_EMTPY,
> RTSER_LSR_OVERRUN_ER ? never Software overrun (just to confirm).
> - Have to tried to open,read,close 2 times in the same program instead
> of killing and running again the program ? You can then determine if
> it comes from the opening/closing routines ?
> - Can you also test by sending data from another computer for example
> (if possible) instead of directly from you GPS. Trying to determine if
> the problem is really the uart hardware or just sofware (your code or
> driver code).
>
> --
> Luc
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xenomai-help] error on rt_dev_read, code Success, what does it  mean?
  2010-06-17  7:49           ` Everett Wang
@ 2010-06-17  8:48             ` Jan Kiszka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2010-06-17  8:48 UTC (permalink / raw)
  To: Everett Wang; +Cc: xenomai

Everett Wang wrote:
> Hi Jan and Luc,
> 
> Thanks for the helping suggestions. After reading from the manual, I
> still have difficult
> finding how to clear RX queue and overflow error. Nor how to purge the
> read buffer. What are
> the functions for these tasks?

Check

http://www.xenomai.org/documentation/xenomai-2.5/html/api/group__profiles.html#gc6abf51719ec6aa6e31f98a237721e01

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-06-17  8:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-12  4:09 [Xenomai-help] error on rt_dev_read, code Success, what does it mean? Everett Wang
2010-06-12  9:31 ` Gilles Chanteperdrix
2010-06-12 10:13   ` Everett Wang
2010-06-12 10:45     ` Jan Kiszka
2010-06-12 17:14       ` Everett Wang
2010-06-14 20:03         ` Jan Kiszka
2010-06-14 14:53     ` Luc ANTOLINOS
2010-06-15  0:45       ` Everett Wang
2010-06-15  9:27         ` Luc ANTOLINOS
2010-06-17  7:49           ` Everett Wang
2010-06-17  8:48             ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.