* [Xenomai-help] (no subject) @ 2011-07-16 10:11 Wong Sheng Chao 2011-07-21 9:36 ` [Xenomai-help] Analogy Differential Mode Wong Sheng Chao 0 siblings, 1 reply; 5+ messages in thread From: Wong Sheng Chao @ 2011-07-16 10:11 UTC (permalink / raw) To: xenomai Hi all I'm using the Analogy API, a4l_sync_read to read an external voltage level from my NI card. I had gone through the insn_read.c example and managed to reproduce a simple working program of my own. However I can't seemed to find the place to define the reference voltage. Looking through the Analogy API, specifically the Driver API - Channels and ranges. It is mentioned that the channel reference can be define through these flags in the structure a4l_chdesc_t, #define A4L_CHAN_AREF_GROUND 0x1 #define A4L_CHAN_AREF_COMMON 0x2 #define A4L_CHAN_AREF_DIFF 0x4 #define A4L_CHAN_AREF_OTHER 0x8 but how do I access this structure to define them? I can't seemed to find the function that return the address of this structure. Linux kernel: 2.6.37.3 adeos patch: 2.9-00 xenomai: 2.5.6 DAQ card: National Instruments PCI_6034E Thanks! ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Xenomai-help] Analogy Differential Mode 2011-07-16 10:11 [Xenomai-help] (no subject) Wong Sheng Chao @ 2011-07-21 9:36 ` Wong Sheng Chao 2011-07-21 21:54 ` Alexis Berlemont 0 siblings, 1 reply; 5+ messages in thread From: Wong Sheng Chao @ 2011-07-21 9:36 UTC (permalink / raw) To: xenomai Hi all I'm still trying to figure out how to configure my NI card to read voltage signal in Differential Mode rather than single ended. I had been reading the API and it seems that I need to create a structure and define it's member accordingly struct a4l_channel { unsigned long flags; /*!< Channel flags to define the reference. */ unsigned long nb_bits; /*!< Channel resolution. */ }; typedef struct a4l_channel a4l_chan_t; with the member flags being one of the following, A4L_CHAN_AREF_GROUND 0x1 A4L_CHAN_AREF_COMMON 0x2 A4L_CHAN_AREF_DIFF 0x4 A4L_CHAN_AREF_OTHER 0x8 and in my case A4L_CHAN_AREF_DIFF My question is which function should I use to send this structure to configure the reference mode and where? I'm thinking it should be between these two functions, but i'm still not sure how I can achieve this. a4l_open(); //configure differential mode here. a4l_fill(); My current setup is as follow Distribution: Ubuntu 10.04 Linux kernel: 2.6.37.3 adeos patch: 2.9-00 xenomai: 2.5.6 DAQ card: National Instruments PCI_6034E Thanks Chao ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Analogy Differential Mode 2011-07-21 9:36 ` [Xenomai-help] Analogy Differential Mode Wong Sheng Chao @ 2011-07-21 21:54 ` Alexis Berlemont 2011-07-26 9:17 ` wong 0 siblings, 1 reply; 5+ messages in thread From: Alexis Berlemont @ 2011-07-21 21:54 UTC (permalink / raw) To: Wong Sheng Chao; +Cc: xenomai Hi, Wong Sheng Chao wrote: > Hi all > > I'm still trying to figure out how to configure my NI card to read voltage > signal in Differential Mode rather than single ended. Sorry. I skipped your mail without subject. >I had been reading > the API and it seems that I need to create a structure and define it's > member accordingly > > struct a4l_channel { > unsigned long flags; /*!< Channel flags to define the reference. */ > unsigned long nb_bits; /*!< Channel resolution. */ > }; > typedef struct a4l_channel a4l_chan_t; > > with the member flags being one of the following, > > A4L_CHAN_AREF_GROUND 0x1 > A4L_CHAN_AREF_COMMON 0x2 > A4L_CHAN_AREF_DIFF 0x4 > A4L_CHAN_AREF_OTHER 0x8 > > and in my case A4L_CHAN_AREF_DIFF > > My question is which function should I use to send this structure to > configure the reference mode and where? I'm thinking it should be between > these two functions, but i'm still not sure how I can achieve this. > You should send a command structure thanks to a4l_snd_command(). See http://www.xenomai.org/documentation/xenomai-2.5/html/api/index.html: /* The channel descriptor table */ static unsigned int chans[MAX_NB_CHAN]; /* The command to send */ a4l_cmd_t cmd = { .idx_subd = ID_SUBD, .flags = 0, .start_src = TRIG_NOW, .start_arg = 0, .scan_begin_src = TRIG_TIMER, .scan_begin_arg = 8000000, /* in ns */ .convert_src = TRIG_TIMER, .convert_arg = 500000, /* in ns */ .scan_end_src = TRIG_COUNT, .scan_end_arg = 0, .stop_src = TRIG_COUNT, .stop_arg = NB_SCAN, .nb_chan = 0, .chan_descs = chans, }; for (i = 0; i < ...; i++) chans[0] = PACK(0, 0, AREF(AREF_DIFF)) | | |_reference flags | |_range number |_channel number By the way, I had a quick look into the pcimio driver and I am not sure that the driver supports differential mode for your card. According to the function ni_load_channelgain_list(), M series boards are OK (which is not the case, I think) and 611x models. If the card PCI_6034E support "diff" mode, the driver should be updated. > a4l_open(); > > //configure differential mode here. > > a4l_fill(); > > > My current setup is as follow > Distribution: Ubuntu 10.04 > Linux kernel: 2.6.37.3 > adeos patch: 2.9-00 > xenomai: 2.5.6 > DAQ card: National Instruments PCI_6034E > > Thanks > Chao > > > > > _______________________________________________ > Xenomai-help mailing list > Xenomai-help@domain.hid > https://mail.gna.org/listinfo/xenomai-help -- Alexis. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Analogy Differential Mode 2011-07-21 21:54 ` Alexis Berlemont @ 2011-07-26 9:17 ` wong 2011-08-01 21:56 ` Alexis Berlemont 0 siblings, 1 reply; 5+ messages in thread From: wong @ 2011-07-26 9:17 UTC (permalink / raw) To: Alexis Berlemont; +Cc: xenomai Hi Alexis Thanks for the information, I followed your advice and tried out the structure and the a4l_snd_command() but i received the error -EINVAL I figured i must had made a mistake in the a4l_cmd_t cmd structure, so here's the specification of my card channels: 16 channels single ended 8 channel differential range: +10V -10V (range_number = 0) subdevice: 0 (analog input) I think the NI PCI-6034E supports differential mode as shown here in the "Specifications" tab http://sine.ni.com/nips/cds/view/p/lang/en/nid/11916 I need to read 6 differential signals and the 6034E has 8 so this should be sufficient. /* The channel descriptor table */ static unsigned int chans[MAX_NB_CHAN]; //The 6034E has 16 single ended and 8 differential so MAX_NB_CHAN = 8? /* The command to send */ a4l_cmd_t cmd = { .idx_subd = ID_SUBD, /*ID_SUBD = 0 for analog input*/ .flags = 0, .start_src = TRIG_NOW, .start_arg = 0, .scan_begin_src = TRIG_TIMER, .scan_begin_arg = 8000000, /* in ns */ .convert_src = TRIG_TIMER, .convert_arg = 500000, /* in ns */ .scan_end_src = TRIG_COUNT, .scan_end_arg = 0, .stop_src = TRIG_COUNT, .stop_arg = NB_SCAN, .nb_chan = 0, .chan_descs = chans, }; I have some question regarding these members 1) .stop_arg = NB_SCAN, Is this the number of scans to stop the acquisition? so theoretically a scan count of 1 should be fine? 2) .nb_chan = 0, According to the comedilib this is the number of channels to be sampled, so in my case it should be 6? I noticed that if i put anything other than 0, 'dmesg' gives an error of [ 4109.517562] Analogy: a4l_ioctl_cmd: driver's cmd_test failed 3) .chan_descs = chans, I don't quite understand this, does this corresponds to the list of channels to be sampled? if I have 6 differential inputs how should i set the chans array with the following for loop for (i = 0; i < MAX_NB_CHAN; i++) chans[0] = PACK(0, 0, AREF(AREF_DIFF)) | | | |_reference flags | | |_range number | |_channel number, shouldn't this be i? |___________ shouldn't this be i? I can't seemed to find the ni_load_channelgain_list() function and how do you check whether the library supports diff mode or not? Thanks again for your help Regards Chao On Thu, 21 Jul 2011 23:54:20 +0200, Alexis Berlemont wrote: > Hi, > > Wong Sheng Chao wrote: >> Hi all >> >> I'm still trying to figure out how to configure my NI card to read >> voltage >> signal in Differential Mode rather than single ended. > Sorry. I skipped your mail without subject. > >>I had been reading >> the API and it seems that I need to create a structure and define >> it's >> member accordingly >> >> struct a4l_channel { >> unsigned long flags; /*!< Channel flags to define the reference. */ >> unsigned long nb_bits; /*!< Channel resolution. */ >> }; >> typedef struct a4l_channel a4l_chan_t; >> >> with the member flags being one of the following, >> >> A4L_CHAN_AREF_GROUND 0x1 >> A4L_CHAN_AREF_COMMON 0x2 >> A4L_CHAN_AREF_DIFF 0x4 >> A4L_CHAN_AREF_OTHER 0x8 >> >> and in my case A4L_CHAN_AREF_DIFF >> >> My question is which function should I use to send this structure to >> configure the reference mode and where? I'm thinking it should be >> between >> these two functions, but i'm still not sure how I can achieve this. >> > > You should send a command structure thanks to a4l_snd_command(). > > See > http://www.xenomai.org/documentation/xenomai-2.5/html/api/index.html: > > /* The channel descriptor table */ > static unsigned int chans[MAX_NB_CHAN]; > > /* The command to send */ > a4l_cmd_t cmd = { > .idx_subd = ID_SUBD, > .flags = 0, > .start_src = TRIG_NOW, > .start_arg = 0, > .scan_begin_src = TRIG_TIMER, > .scan_begin_arg = 8000000, /* in ns */ > .convert_src = TRIG_TIMER, > .convert_arg = 500000, /* in ns */ > .scan_end_src = TRIG_COUNT, > .scan_end_arg = 0, > .stop_src = TRIG_COUNT, > .stop_arg = NB_SCAN, > .nb_chan = 0, > .chan_descs = chans, > }; > > for (i = 0; i < ...; i++) > chans[0] = PACK(0, 0, AREF(AREF_DIFF)) > | | |_reference flags > | |_range number > |_channel number > > By the way, I had a quick look into the pcimio driver and I am not > sure that the driver supports differential mode for your > card. According to the function ni_load_channelgain_list(), M series > boards are OK (which is not the case, I think) and 611x models. > > If the card PCI_6034E support "diff" mode, the driver should be > updated. > >> a4l_open(); >> >> //configure differential mode here. >> >> a4l_fill(); >> >> >> My current setup is as follow >> Distribution: Ubuntu 10.04 >> Linux kernel: 2.6.37.3 >> adeos patch: 2.9-00 >> xenomai: 2.5.6 >> DAQ card: National Instruments PCI_6034E >> >> Thanks >> Chao >> >> >> >> >> _______________________________________________ >> Xenomai-help mailing list >> Xenomai-help@domain.hid >> https://mail.gna.org/listinfo/xenomai-help ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Analogy Differential Mode 2011-07-26 9:17 ` wong @ 2011-08-01 21:56 ` Alexis Berlemont 0 siblings, 0 replies; 5+ messages in thread From: Alexis Berlemont @ 2011-08-01 21:56 UTC (permalink / raw) To: wong; +Cc: xenomai Hi, Sorry for the late reply, I am currently on holidays. On Tue, Jul 26, 2011 at 11:17 AM, wong <wong@domain.hid> wrote: > Hi Alexis > > Thanks for the information, I followed your advice and tried out the > structure and the a4l_snd_command() but i received the error -EINVAL > > I figured i must had made a mistake in the a4l_cmd_t cmd structure, so > here's the specification of my card > > channels: 16 channels single ended 8 channel differential > range: +10V -10V (range_number = 0) > subdevice: 0 (analog input) > > I think the NI PCI-6034E supports differential mode as shown here in the > "Specifications" tab > > http://sine.ni.com/nips/cds/view/p/lang/en/nid/11916 > > I need to read 6 differential signals and the 6034E has 8 so this should be > sufficient. > > /* The channel descriptor table */ > static unsigned int chans[MAX_NB_CHAN]; //The 6034E has 16 single ended and > 8 differential so MAX_NB_CHAN = 8? > > > /* The command to send */ > a4l_cmd_t cmd = { > .idx_subd = ID_SUBD, /*ID_SUBD = 0 for analog input*/ > .flags = 0, > .start_src = TRIG_NOW, > .start_arg = 0, > .scan_begin_src = TRIG_TIMER, > .scan_begin_arg = 8000000, /* in ns */ > .convert_src = TRIG_TIMER, > .convert_arg = 500000, /* in ns */ > .scan_end_src = TRIG_COUNT, > .scan_end_arg = 0, > .stop_src = TRIG_COUNT, > .stop_arg = NB_SCAN, > .nb_chan = 0, > .chan_descs = chans, > }; > > > I have some question regarding these members > > 1) .stop_arg = NB_SCAN, > Is this the number of scans to stop the acquisition? so theoretically a scan > count of 1 should be fine? > Theoretically yes. > 2) .nb_chan = 0, > According to the comedilib this is the number of channels to be sampled, so > in my case it should be 6? I noticed that if i put anything other than 0, > 'dmesg' gives an error of > > [ 4109.517562] Analogy: a4l_ioctl_cmd: driver's cmd_test failed There is nothing else, just before this line. If my memories are correct the reason why the test of your command failed should be indicated. If that is not the case, there is a bug. Tell me and I will look at it. > > > 3) .chan_descs = chans, > I don't quite understand this, does this corresponds to the list of channels > to be sampled? if I have 6 differential inputs how should i set the chans > array with the following for loop > > > for (i = 0; i < MAX_NB_CHAN; i++) > chans[0] = PACK(0, 0, AREF(AREF_DIFF)) > | | | |_reference flags > | | |_range number > | |_channel number, shouldn't this be i? > |___________ shouldn't this be i? > > for (i = 0; i < 6; i++) chans[0] = PACK(i, the_range_you_want, AREF(AREF_DIFF)) No? > > I can't seemed to find the ni_load_channelgain_list() function and how do > you check whether the library supports diff mode or not? > ni_load_channelgain_list() function is located in the driver source: ksrc/drivers/analogy/national_instruments/mio_common.c. If I remember well, even if the hardware specifications tell that your board supports differential mode, this function does not. > Thanks again for your help > > Regards > Chao > > Alexis. > > > > > On Thu, 21 Jul 2011 23:54:20 +0200, Alexis Berlemont wrote: >> >> Hi, >> >> Wong Sheng Chao wrote: >>> >>> Hi all >>> >>> I'm still trying to figure out how to configure my NI card to read >>> voltage >>> signal in Differential Mode rather than single ended. >> >> Sorry. I skipped your mail without subject. >> >>> I had been reading >>> the API and it seems that I need to create a structure and define it's >>> member accordingly >>> >>> struct a4l_channel { >>> unsigned long flags; /*!< Channel flags to define the reference. >>> */ >>> unsigned long nb_bits; /*!< Channel resolution. */ >>> }; >>> typedef struct a4l_channel a4l_chan_t; >>> >>> with the member flags being one of the following, >>> >>> A4L_CHAN_AREF_GROUND 0x1 >>> A4L_CHAN_AREF_COMMON 0x2 >>> A4L_CHAN_AREF_DIFF 0x4 >>> A4L_CHAN_AREF_OTHER 0x8 >>> >>> and in my case A4L_CHAN_AREF_DIFF >>> >>> My question is which function should I use to send this structure to >>> configure the reference mode and where? I'm thinking it should be between >>> these two functions, but i'm still not sure how I can achieve this. >>> >> >> You should send a command structure thanks to a4l_snd_command(). >> >> See http://www.xenomai.org/documentation/xenomai-2.5/html/api/index.html: >> >> /* The channel descriptor table */ >> static unsigned int chans[MAX_NB_CHAN]; >> >> /* The command to send */ >> a4l_cmd_t cmd = { >> .idx_subd = ID_SUBD, >> .flags = 0, >> .start_src = TRIG_NOW, >> .start_arg = 0, >> .scan_begin_src = TRIG_TIMER, >> .scan_begin_arg = 8000000, /* in ns */ >> .convert_src = TRIG_TIMER, >> .convert_arg = 500000, /* in ns */ >> .scan_end_src = TRIG_COUNT, >> .scan_end_arg = 0, >> .stop_src = TRIG_COUNT, >> .stop_arg = NB_SCAN, >> .nb_chan = 0, >> .chan_descs = chans, >> }; >> >> for (i = 0; i < ...; i++) >> chans[0] = PACK(0, 0, AREF(AREF_DIFF)) >> | | |_reference flags >> | |_range number >> |_channel number >> >> By the way, I had a quick look into the pcimio driver and I am not >> sure that the driver supports differential mode for your >> card. According to the function ni_load_channelgain_list(), M series >> boards are OK (which is not the case, I think) and 611x models. >> >> If the card PCI_6034E support "diff" mode, the driver should be >> updated. >> >>> a4l_open(); >>> >>> //configure differential mode here. >>> >>> a4l_fill(); >>> >>> >>> My current setup is as follow >>> Distribution: Ubuntu 10.04 >>> Linux kernel: 2.6.37.3 >>> adeos patch: 2.9-00 >>> xenomai: 2.5.6 >>> DAQ card: National Instruments PCI_6034E >>> >>> Thanks >>> Chao >>> >>> >>> >>> >>> _______________________________________________ >>> Xenomai-help mailing list >>> Xenomai-help@domain.hid >>> https://mail.gna.org/listinfo/xenomai-help > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-01 21:56 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-16 10:11 [Xenomai-help] (no subject) Wong Sheng Chao 2011-07-21 9:36 ` [Xenomai-help] Analogy Differential Mode Wong Sheng Chao 2011-07-21 21:54 ` Alexis Berlemont 2011-07-26 9:17 ` wong 2011-08-01 21:56 ` Alexis Berlemont
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.