* [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore
@ 2009-10-29 0:19 Stefan Schaal
2009-10-29 8:30 ` Gilles Chanteperdrix
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Stefan Schaal @ 2009-10-29 0:19 UTC (permalink / raw)
To: xenomai; +Cc: Peter Pastor Sampedro
Hi,
this is following up on an installation of Alex's Xenomai tree on
Ubuntu 9.04 running the 2.6.29.5 kernel. While we managed to talk to
the NI data acquisition board we have with this tree, we suddenly
discovered that some of our other software doesn't work anymore, in
particular threads. Below is a tiny program to run a thread, and the
compile statement we use. The thread never starts running. Does
anybody know what is going wrong here?
Thanks a lot for any hint!
Best wishes,
-Stefan
compile statement:
gcc -o xtest xeno_thread_test.c -I/Network/Servers/duerer/clmc/prog/
include -I/usr/xenomai/include -I/usr/xenomai/include/posix -
D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -Wl,@/usr/xenomai/lib/
posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lpthread -lrt
run the executable:
unix> xtest (which should generate some print-outs, but it doesn't ...)
//------------------------------------------------- start of file
-----------------------------------------------------------------------
#include <sys/mman.h>
#include <pthread.h>
#include <stdio.h>
pthread_t cthread;
// a quick thread to run ....
void *
run_thread(void *dummy)
{
int i;
for (i=1; i<=1000; ++i) {
printf("%d thread is runnning\n",i);
sleep(1);
}
return NULL;
}
// main program
int
main() {
int rc;
pthread_attr_t pth_attr;
#ifdef __XENO__
mlockall(MCL_CURRENT | MCL_FUTURE);
#endif
if ((rc=pthread_attr_init(&pth_attr)))
printf("pthread_attr_init returned %d\n",rc);
if ((rc=pthread_create( &cthread, &pth_attr, run_thread, NULL)))
printf("pthread_create returned with %d\n",rc);
// wait a bit to get some print outs from the thread
sleep(10);
return 1;
}
// ----------------------------------- end of file
------------------------------------------------------------
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore
2009-10-29 0:19 [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore Stefan Schaal
@ 2009-10-29 8:30 ` Gilles Chanteperdrix
2009-10-29 8:52 ` Gilles Chanteperdrix
2009-10-29 14:08 ` Gilles Chanteperdrix
2 siblings, 0 replies; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-10-29 8:30 UTC (permalink / raw)
To: Stefan Schaal; +Cc: xenomai, Peter Pastor Sampedro
Stefan Schaal wrote:
> Hi,
>
> this is following up on an installation of Alex's Xenomai tree on
> Ubuntu 9.04 running the 2.6.29.5 kernel. While we managed to talk to
> the NI data acquisition board we have with this tree, we suddenly
> discovered that some of our other software doesn't work anymore, in
> particular threads. Below is a tiny program to run a thread, and the
> compile statement we use. The thread never starts running. Does
> anybody know what is going wrong here?
>
> Thanks a lot for any hint!
On what platform, what version of Xenomai? Are not there any kernel
messages?
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore
2009-10-29 0:19 [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore Stefan Schaal
2009-10-29 8:30 ` Gilles Chanteperdrix
@ 2009-10-29 8:52 ` Gilles Chanteperdrix
2009-10-29 14:08 ` Gilles Chanteperdrix
2 siblings, 0 replies; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-10-29 8:52 UTC (permalink / raw)
To: Stefan Schaal; +Cc: xenomai, Peter Pastor Sampedro
Stefan Schaal wrote:
> Hi,
>
> this is following up on an installation of Alex's Xenomai tree on
> Ubuntu 9.04 running the 2.6.29.5 kernel. While we managed to talk to
> the NI data acquisition board we have with this tree, we suddenly
> discovered that some of our other software doesn't work anymore, in
> particular threads. Below is a tiny program to run a thread, and the
> compile statement we use. The thread never starts running. Does
> anybody know what is going wrong here?
>
> Thanks a lot for any hint!
>
> Best wishes,
>
> -Stefan
>
> compile statement:
>
> gcc -o xtest xeno_thread_test.c -I/Network/Servers/duerer/clmc/prog/
> include -I/usr/xenomai/include -I/usr/xenomai/include/posix -
> D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -Wl,@/usr/xenomai/lib/
> posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lpthread -lrt
>
>
> run the executable:
>
> unix> xtest (which should generate some print-outs, but it doesn't ...)
Could you send me (privately), the xtest binary?
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore
2009-10-29 0:19 [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore Stefan Schaal
2009-10-29 8:30 ` Gilles Chanteperdrix
2009-10-29 8:52 ` Gilles Chanteperdrix
@ 2009-10-29 14:08 ` Gilles Chanteperdrix
2009-10-29 15:25 ` Stefan Schaal
2 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-10-29 14:08 UTC (permalink / raw)
To: Stefan Schaal; +Cc: xenomai, Peter Pastor Sampedro
Stefan Schaal wrote:
> Hi,
>
> this is following up on an installation of Alex's Xenomai tree on
> Ubuntu 9.04 running the 2.6.29.5 kernel. While we managed to talk to
> the NI data acquisition board we have with this tree, we suddenly
> discovered that some of our other software doesn't work anymore, in
> particular threads. Below is a tiny program to run a thread, and the
> compile statement we use. The thread never starts running. Does
> anybody know what is going wrong here?
>
> Thanks a lot for any hint!
Ok, you have been hit by a combo of two bugs:
- you are compiling with static libraries because dynamic libraries are
temporarily disabled (due to a bug in configure.in for which Jan has
provided the fix just today);
- the --wrap mechanism used by the Xenomai posix skin has a known issue
with static libraries.
Fortunately, we recently implemented a fix for this second bug: use the
wrap-link.sh script on the compilation command line.
As in:
/usr/xenomai/bin/wrap-link.sh gcc -o xtest xeno_thread_test.c
-I/Network/Servers/duerer/clmc/prog/
include -I/usr/xenomai/include -I/usr/xenomai/include/posix -
D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -Wl,@/usr/xenomai/lib/
posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lpthread -lrt
Please tell us if it still does not work.
--
Gilles
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore
2009-10-29 14:08 ` Gilles Chanteperdrix
@ 2009-10-29 15:25 ` Stefan Schaal
[not found] ` <FF6D4747-95BE-4B18-8B77-864B7DA5EAEF@usc.edu>
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Schaal @ 2009-10-29 15:25 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai, Peter Pastor Sampedro
Hi Gilles,
this works -- thanks a lot! I will also look out for the
configure.in fix and try this one afterwards.
Best wishes,
-Stefan
On Oct 29, 2009, at 7:08, Gilles Chanteperdrix wrote:
> Stefan Schaal wrote:
>> Hi,
>>
>> this is following up on an installation of Alex's Xenomai tree on
>> Ubuntu 9.04 running the 2.6.29.5 kernel. While we managed to talk to
>> the NI data acquisition board we have with this tree, we suddenly
>> discovered that some of our other software doesn't work anymore, in
>> particular threads. Below is a tiny program to run a thread, and the
>> compile statement we use. The thread never starts running. Does
>> anybody know what is going wrong here?
>>
>> Thanks a lot for any hint!
>
> Ok, you have been hit by a combo of two bugs:
> - you are compiling with static libraries because dynamic libraries
> are
> temporarily disabled (due to a bug in configure.in for which Jan has
> provided the fix just today);
> - the --wrap mechanism used by the Xenomai posix skin has a known
> issue
> with static libraries.
>
> Fortunately, we recently implemented a fix for this second bug: use
> the
> wrap-link.sh script on the compilation command line.
>
> As in:
>
> /usr/xenomai/bin/wrap-link.sh gcc -o xtest xeno_thread_test.c
> -I/Network/Servers/duerer/clmc/prog/
> include -I/usr/xenomai/include -I/usr/xenomai/include/posix -
> D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -Wl,@/usr/xenomai/
> lib/
> posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lpthread -lrt
>
> Please tell us if it still does not work.
>
> --
> Gilles
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Xenomai-core] digital I/O with analgoy using ni_pcmcia
[not found] ` <4AE9E5AC.7050401@domain.hid>
@ 2009-12-18 21:10 ` Stefan Schaal
2009-12-21 23:23 ` Alexis Berlemont
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Schaal @ 2009-12-18 21:10 UTC (permalink / raw)
To: xenomai; +Cc: Jonas Buchli, Peter Pastor Sampedro, Ludovic Righetti
Hi everybody,
we have an NI6259 board working xenomai 2.5, using the analogy APIs. Read/write to analog channels is quite straightforward and can be inferred from the cmd_read and cmd_write source code. Now I would also like to use the digital I/O of this board (e.g., the 32 digital I/O lines). In Comedi, there are functions to set the DIO lines to input/output mode (comedi_dio_config), and then functions to read/write, like comedi_dio_read and comedi_dio_write. Does xenomai/analogy already have similar functionality?
Thanks a lot,
-Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-core] digital I/O with analgoy using ni_pcmcia
2009-12-18 21:10 ` [Xenomai-core] digital I/O with analgoy using ni_pcmcia Stefan Schaal
@ 2009-12-21 23:23 ` Alexis Berlemont
2009-12-22 7:02 ` Stefan Schaal
0 siblings, 1 reply; 8+ messages in thread
From: Alexis Berlemont @ 2009-12-21 23:23 UTC (permalink / raw)
To: Stefan Schaal
Cc: Jonas Buchli, Peter Pastor Sampedro, Ludovic Righetti, xenomai
Hi,
Stefan Schaal wrote:
> Hi everybody,
>
> we have an NI6259 board working xenomai 2.5, using the analogy APIs.
> Read/write to analog channels is quite straightforward and can be
> inferred from the cmd_read and cmd_write source code. Now I would also
> like to use the digital I/O of this board (e.g., the 32 digital I/O
> lines). In Comedi, there are functions to set the DIO lines to
> input/output mode (comedi_dio_config), and then functions to read/write,
> like comedi_dio_read and comedi_dio_write. Does xenomai/analogy already
> have similar functionality?
Many thanks for this question, it is an issue I have been
keeping on postponing the resolution. Currently, the functions are not
implemented but it could be quickly done.
Here is my understanding of the Comedi DIO features; please, correct
me if I am wrong.
In Comedi, here is the list of functions related with DIO:
- comedi_dio_read (insn_read or deprecated insn trigger)
- comedi_dio_write (insn_write or deprecated insn trigger)
- comedi_dio_config (insn_config or deprecated insn trigger)
- comedi_dio_get_config (insn_config or deprecated trigger)
- comedi_dio_bitfield (insn_bits or comedi_dio_read/write)
- comedi_dio_bitfield2 (insn_bits or comedi_dio_read/write)
The instruction insn_bits is a combination of a read operation and a
write operation (that is why, the function comedi_dio_bitfield* call
comedi_dio_read and comedi_dio_write if the driver does not provide an
insn-bits handler).
I had a look at many Comedi drivers and most of them register the
handler "insn_bits" for the DIO subdevice. The instructions insn_read
and insn_write are not oftenly used in DIO contexts.
comedi_dio_bitfield() uses the insn_bits instruction. However, it only
works with DIO subdevice limited to 32 channels; that was why
comedi_dio_bitfield2() was introduced, this latter function contains
one more argument so as to shift the bits.
Consequently, we may need a more limited set of functions:
- a4l_sync_dio(dsc, idx_subd, mask, buf)
- a4l_sizeof_subd(dsc, idx_subd)
- a4l_config_subd(dsc, idx_subd, idx_chan, cfg_type, *val)
a4l_sync_dio() could work with any DIO subdevice (more or less than 32
channels). The last argument would be a pointer to a buffer which size
should be defined thanks to a4l_sizeof_subd() (8, 16, 32, 64 or more
bits).
a4l_config_subd() could be used to configure the polarity of the DIO
channels. The argument cfg_type could be set to DIO_INPUT, DIO_OUTPUT,
DIO_QUERY. And, we could even imagine that this function would not be
limited to DIO subdevice; so, the argument cfg_type could accept more
values (SERIAL_CLOCK, BIDIRECTIONAL_DATA, SET_CLOCK_SRC,
GET_CLOCK_SRC, etc.)
How do you see this approach ?
Do you (or anyone else) have a better solution in mind ?
Best regards,
> Thanks a lot,
>
> -Stefan
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
>
Alexis.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-core] digital I/O with analgoy using ni_pcmcia
2009-12-21 23:23 ` Alexis Berlemont
@ 2009-12-22 7:02 ` Stefan Schaal
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Schaal @ 2009-12-22 7:02 UTC (permalink / raw)
To: Alexis Berlemont
Cc: Jonas Buchli, Peter Pastor Sampedro, Ludovic Righetti, xenomai
Hi Alexis,
thanks a lot for all these suggestions. For my applications, the functions you listed below would be entirely sufficient. Essentially, I need to be able to put selected channels on the DIO in either read or write mode, and then simply read from them or write from them. The protocol I use requires 16 data bits, and 3 additional control lines. It was originally implemented under vxWorks. Nothing fancy at all.
Thanks a lot for your kind help!
-Stefan
On Dec 21, 2009, at 15:23, Alexis Berlemont wrote:
> Hi,
>
> Stefan Schaal wrote:
>> Hi everybody,
>> we have an NI6259 board working xenomai 2.5, using the analogy APIs.
>> Read/write to analog channels is quite straightforward and can be
>> inferred from the cmd_read and cmd_write source code. Now I would also
>> like to use the digital I/O of this board (e.g., the 32 digital I/O
>> lines). In Comedi, there are functions to set the DIO lines to
>> input/output mode (comedi_dio_config), and then functions to read/write,
>> like comedi_dio_read and comedi_dio_write. Does xenomai/analogy already
>> have similar functionality?
>
> Many thanks for this question, it is an issue I have been
> keeping on postponing the resolution. Currently, the functions are not implemented but it could be quickly done.
>
> Here is my understanding of the Comedi DIO features; please, correct
> me if I am wrong.
>
> In Comedi, here is the list of functions related with DIO:
> - comedi_dio_read (insn_read or deprecated insn trigger)
> - comedi_dio_write (insn_write or deprecated insn trigger)
> - comedi_dio_config (insn_config or deprecated insn trigger)
> - comedi_dio_get_config (insn_config or deprecated trigger)
> - comedi_dio_bitfield (insn_bits or comedi_dio_read/write)
> - comedi_dio_bitfield2 (insn_bits or comedi_dio_read/write)
>
> The instruction insn_bits is a combination of a read operation and a
> write operation (that is why, the function comedi_dio_bitfield* call
> comedi_dio_read and comedi_dio_write if the driver does not provide an
> insn-bits handler).
>
> I had a look at many Comedi drivers and most of them register the
> handler "insn_bits" for the DIO subdevice. The instructions insn_read
> and insn_write are not oftenly used in DIO contexts.
>
> comedi_dio_bitfield() uses the insn_bits instruction. However, it only
> works with DIO subdevice limited to 32 channels; that was why
> comedi_dio_bitfield2() was introduced, this latter function contains
> one more argument so as to shift the bits.
>
> Consequently, we may need a more limited set of functions:
> - a4l_sync_dio(dsc, idx_subd, mask, buf)
> - a4l_sizeof_subd(dsc, idx_subd)
> - a4l_config_subd(dsc, idx_subd, idx_chan, cfg_type, *val)
>
> a4l_sync_dio() could work with any DIO subdevice (more or less than 32
> channels). The last argument would be a pointer to a buffer which size
> should be defined thanks to a4l_sizeof_subd() (8, 16, 32, 64 or more
> bits).
>
> a4l_config_subd() could be used to configure the polarity of the DIO
> channels. The argument cfg_type could be set to DIO_INPUT, DIO_OUTPUT,
> DIO_QUERY. And, we could even imagine that this function would not be
> limited to DIO subdevice; so, the argument cfg_type could accept more
> values (SERIAL_CLOCK, BIDIRECTIONAL_DATA, SET_CLOCK_SRC,
> GET_CLOCK_SRC, etc.)
>
> How do you see this approach ?
>
> Do you (or anyone else) have a better solution in mind ?
>
> Best regards,
>
>> Thanks a lot,
>> -Stefan
>> _______________________________________________
>> Xenomai-core mailing list
>> Xenomai-core@domain.hid
>> https://mail.gna.org/listinfo/xenomai-core
> Alexis.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-12-22 7:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 0:19 [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore Stefan Schaal
2009-10-29 8:30 ` Gilles Chanteperdrix
2009-10-29 8:52 ` Gilles Chanteperdrix
2009-10-29 14:08 ` Gilles Chanteperdrix
2009-10-29 15:25 ` Stefan Schaal
[not found] ` <FF6D4747-95BE-4B18-8B77-864B7DA5EAEF@usc.edu>
[not found] ` <4AE9E5AC.7050401@domain.hid>
2009-12-18 21:10 ` [Xenomai-core] digital I/O with analgoy using ni_pcmcia Stefan Schaal
2009-12-21 23:23 ` Alexis Berlemont
2009-12-22 7:02 ` Stefan Schaal
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.