Gilles, (and anyone else who has had overrun errors or has experience with the
Xenomai serial port driver)
It seems that even though I turned off fprintf and even though I stopped
logging to disk, I still get the same number of overrun errors. I broke the
loop down to the bare basics.
my task now consists of the following
Task was launched as follows:rt_task_create(&read_task, "read_task", 0, 51, 0);
void sensor::mainloop()
{
//set up serial read
struct rtser_event rx_event;
rtser_status_t serstatus;
int numread,err;
while(1)
{
if(exitprogram) //
break;
err = rt_dev_ioctl(read_fd, RTSER_RTIOC_WAIT_EVENT,
&rx_event);
if (err)
{
printf(RTASK_PREFIX
"error on
RTSER_RTIOC_WAIT_EVENT, %s\n",
strerror(-err));
err = rt_dev_ioctl(read_fd,
RTSER_RTIOC_GET_STATUS, &serstatus);
printf(RTASK_PREFIX "Error code line_status=%d
modem_status=%d\n",serstatus.line_status, serstatus.modem_status);
}
else
{
numread = rt_dev_read(read_fd, buf, 1);
{
printf(RTASK_PREFIX "error on
rt_dev_read, code %d %s\n",numread,
strerror(-numread));
err = rt_dev_ioctl(read_fd,
RTSER_RTIOC_GET_STATUS, &serstatus);
printf(RTASK_PREFIX "Error code
line_status=%d modem_status=%d\n",serstatus.line_status,
serstatus.modem_status);
continue;
}
else
{
err = rt_dev_ioctl(read_fd,
RTSER_RTIOC_GET_STATUS, &serstatus); //if data received normally, make sure 96
was received, 98 = overrun
if(!serstatus.line_status==96)
printf(RTASK_PREFIX "Error code line_status=%d
modem_status=%d\n",serstatus.line_status, serstatus.modem_status);
}
}
}
Thank you,
Joshua Karch
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[EMAIL PROTECTED]
Sent: Wed 4/23/2008 5:28 PM
To: Karch, Joshua
Cc: [email protected]
Subject: RE: [Xenomai-help] Xenomai serial port c++ code and / or
xeno--(xenomm-0.0.1) install problem
Karch, Joshua wrote:
>
> Gilles,
>
> I decided to eliminate the pthread and create a task that handles the entire
> packet process, from reading the serial port, to decoding data, to disk io
> (saving the data to disk) The only thing that's serviced occasionally is
> the main loop, which looks every half second for a keypress to quit.
>
> Now, I get overrun errors once every 10 seconds to 30 seconds. The machine
> is a PC/104 and I'm using fprintf to print the data received from the sensor
> to file-- should I use perhaps an RT version?.
No, as I already explained, you can not use fprintf and hope remaining
deterministic.
There is no function writing data to disk while remaining
deterministic. That would mean have disk drivers and so on written for
xenomai.
You have to design your application with an rt-task doing the rt work,
and a non rt-task doing the non rt work. This non rt-task can be a
classical pthread, in which case you will have to use an rt_pipe for
communications between the two tasks. Or the non rt-task can be a
xenomai thread with priority 0, in which case you can use any other
IPC.
For assistance in the daunting task of keeping deterministic, see the
bit T_WARNSW of the rt_task_set_mode service, or the bit PTHREAD_WARNSW
of the pthread_set_mode_np service.
--
Gilles.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help