Interfacing ADVANTECH PCI 1724

37 views
Skip to first unread message

Ravi shankar

unread,
Nov 5, 2019, 12:12:49 AM11/5/19
to Comedi: Linux Control and Measurement Device Interface

Hi,

I have installed Comedi , RTAI in UBUNTU 16.04 Version.

I want to interface ADVANTECH PCI 1724U through Comedi in RTAI frame work.
But the Comedi is not supporting this specific card.
Could you please tell me how i can access this card in RTAI+COMEDI frame work.

Thank you.

Ian Abbott

unread,
Nov 5, 2019, 7:58:46 AM11/5/19
to comed...@googlegroups.com, Ravi shankar
Frank Mori Hess wrote a driver for this card in 2013 for the version of
Comedi included in the Linux kernel "staging" sources (included in Linux
kernel version 3.10 onwards).

For RTAI, I guess you are using the "out-of-tree" Comedi Linux kernel
modules from our Git repository on GitHub, and the required driver for
the PCI 1724U is not yet present, but I have some good news for you.

I have just back-ported Frank's "adv_pci1724" driver and pushed it to
our repository on GitHub. It compiles OK, but I am unable to test it.
Please give it a try.

--
-=( Ian Abbott <abb...@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268. Registered address: )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

Ravi shankar

unread,
Nov 6, 2019, 4:37:19 AM11/6/19
to Comedi: Linux Control and Measurement Device Interface

Sir, I have tested that and it is working fine in my RTAI+COMEDI framework.

However my application demands outputting the analog data on all 32 channels synchronously.(i.e all at a time)
could you please help me whether this feature is supported or not? through comedi

Ian Abbott

unread,
Nov 6, 2019, 7:56:23 AM11/6/19
to comed...@googlegroups.com, Ravi shankar
On 06/11/2019 09:37, Ravi shankar wrote:
>
> Sir, I have tested that and it is working fine in my RTAI+COMEDI framework.
>
> However my application demands outputting the analog data on all 32
> channels synchronously.(i.e all at a time)
> could you please help me whether this feature is supported or not?
> through comedi

Synchronized output to analog channels is not part of the normal
functions of comedi, but a few devices supported by comedi support
synchronized output by various means.

The adv_pci1724 driver does not currently support synchronized output.
It could be made to do so by supporting INSN_CONFIG instructions on
subdevice 0 (the normal analog output subdevice) to configure
synchronization mode and trigger synchronized output. (I guess it
wouldn't be needed for the two calibration subdevices.)

There are various ways it could be implemented. Here is one way:

* Use a INSN_CONFIG_ARM instruction with data[1] set to 0 to enable
synchronized output mode:

int enable_sync_output(comedi_t *d)
comedi_insn insn;
lsampl_t data[2];

memset(&insn, 0, sizeof(comedi_insn));
insn.insn = INSN_CONFIG;
insn.subdev = 0;
insn.channel = 0;
insn.data = data;
insn.n = 2;
data[0] = INSN_CONFIG_ARM;
data[1] = 0; /* 0 = only enable sync output */
return comedi_do_insn(d, &insn);
}

* Use a INSN_CONFIG_ARM instruction with data[1] set to 1 to trigger
synchronized output:

int trigger_sync_output(comedi_t *d)
comedi_insn insn;
lsampl_t data[2];

memset(&insn, 0, sizeof(comedi_insn));
insn.insn = INSN_CONFIG;
insn.subdev = 0;
insn.channel = 0;
insn.data = data;
insn.n = 2;
data[0] = INSN_CONFIG_ARM;
data[1] = 1; /* 1 = trigger sync output */
return comedi_do_insn(d, &insn);
}

* Use a INSN_CONFIG_DISARM instruction to disable synchronized output
mode (return to direct output mode):

int disable_sync_output(comedi_t *d)
comedi_insn insn;
lsampl_t data[1];

memset(&insn, 0, sizeof(comedi_insn));
insn.insn = INSN_CONFIG;
insn.subdev = 0;
insn.channel = 0;
insn.data = data;
insn.n = 1;
data[0] = INSN_CONFIG_DISARM;
return comedi_do_insn(d, &insn);
}

If the above implementation looks reasonable to you, I'll have a go at
implementing it.

>
>
> On Tuesday, November 5, 2019 at 6:28:46 PM UTC+5:30, Ian Abbott wrote:
>
> On 05/11/2019 05:12, Ravi shankar wrote:
> >
> > Hi,
> >
> > I have installed Comedi , RTAI in UBUNTU 16.04 Version.
> >
> > I want to interface ADVANTECH PCI 1724U through Comedi in RTAI
> frame work.
> > But the Comedi is not supporting this specific card.
> > Could you please tell me how i can access this card in
> RTAI+COMEDI frame
> > work.
> >
> > Thank you.
>
> Frank Mori Hess wrote a driver for this card in 2013 for the version of
> Comedi included in the Linux kernel "staging" sources (included in
> Linux
> kernel version 3.10 onwards).
>
> For RTAI, I guess you are using the "out-of-tree" Comedi Linux kernel
> modules from our Git repository on GitHub, and the required driver for
> the PCI 1724U is not yet present, but I have some good news for you.
>
> I have just back-ported Frank's "adv_pci1724" driver and pushed it to
> our repository on GitHub.  It compiles OK, but I am unable to test it.
> Please give it a try.
>
> --
> -=( Ian Abbott <abb...@mev.co.uk <javascript:>> || Web:
> www.mev.co.uk <http://www.mev.co.uk> )=-
> -=( MEV Ltd. is a company registered in England & Wales. )=-
> -=( Registered number: 02862268.  Registered address:    )=-
> -=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
>
> --
> You received this message because you are subscribed to the Google
> Groups "Comedi: Linux Control and Measurement Device Interface" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to comedi_list...@googlegroups.com
> <mailto:comedi_list...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/comedi_list/cd9b6732-f4b6-44d0-bec9-2fd2e40e7aa4%40googlegroups.com
> <https://groups.google.com/d/msgid/comedi_list/cd9b6732-f4b6-44d0-bec9-2fd2e40e7aa4%40googlegroups.com?utm_medium=email&utm_source=footer>.

Ravi shankar

unread,
Nov 7, 2019, 6:04:24 AM11/7/19
to Comedi: Linux Control and Measurement Device Interface

When i see the data sheet of PCI 1724 U,

it is mentioned as below for enabling synchrounous outputs>

1. SYN bit in Synchronous Output Control Register/DAC Ready Status
Register (at off set address of 0X04 ) should be set to '1'.
But i observed you are setting '0'

int enable_sync_output(comedi_t *d)
     comedi_insn insn;
     lsampl_t data[2];

     memset(&insn, 0, sizeof(comedi_insn));
     insn.insn = INSN_CONFIG;
     insn.subdev = 0;
     insn.channel = 0;
     insn.data = data;
     insn.n = 2;
     data[0] = INSN_CONFIG_ARM;
     data[1] = 0; /* 0 = only enable sync output */
     return comedi_do_insn(d, &insn);
}

2. Update all 32 channels with data value by writing into DAC Control Register (at offset adrss of 0X00).

3. Write any value to synchrnously ouput all DAC channels in :Synchronous Output Trigger Register-0x0C

it seems to be fine.

please add this feature in adv_pci1724 .

Thanking you for your unconditional support.

Ian Abbott

unread,
Nov 7, 2019, 7:09:28 AM11/7/19
to comed...@googlegroups.com, Ravi shankar
On 07/11/2019 11:04, Ravi shankar wrote:
>
> When i see the data sheet of PCI 1724 U,
>
> it is mentioned as below for enabling synchrounous outputs>
>
> 1. SYN bit in Synchronous Output Control Register/DAC Ready Status
> Register (at off set address of 0X04 ) should be set to '1'.
> But i observed you are setting '0'
>
> int enable_sync_output(comedi_t *d)
>      comedi_insn insn;
>      lsampl_t data[2];
>
>      memset(&insn, 0, sizeof(comedi_insn));
>      insn.insn = INSN_CONFIG;
>      insn.subdev = 0;
>      insn.channel = 0;
>      insn.data = data;
>      insn.n = 2;
>      data[0] = INSN_CONFIG_ARM;
>      data[1] = 0; /* 0 = only enable sync output */
>      return comedi_do_insn(d, &insn);
> }

I'm not sure whether your "But i observed you are setting '0'" comment
is referring the enable_sync_output() function above, or referring to
the setting of the SYN bit in register 0x04.

The intention of my proposed change is that the INSN_CONFIG_ARM
instruction will set the SYN bit and that the INSN_CONFIG_DISARM
instruction will clear the SYN bit. Additionally, the data[1] value of
the INSN_CONFIG_ARM instruction may be set to trigger synchronous output
(step 3 below).

>
> 2. Update all 32 channels with data value by writing into DAC Control
> Register (at offset adrss of 0X00).
>
> 3. Write any value to synchrnously ouput all DAC channels in
> :Synchronous Output Trigger Register-0x0C

With my proposed change, sending an INSN_CONFIG_ARM instruction with
data[1] set to a non-zero value will result in a write to register 0x0C
as above.

Also, the INSN_CONFIG_ARM and INSN_CONFIG_DISARM instructions will wait
for the DACSTAT bit in register 0x04 to clear first before they change
the SYN bit or write to the trigger register.

Also, writes to the calibration subdevice channels will clear the SYN
bit, but the SYN bit setting will be restored by the next write to the
main subdevice channels, or by the INSN_CONFIG_ARM instruction.

>
> it seems to be fine.
>
> please add this feature in adv_pci1724 .
>
> Thanking you for your unconditional support.

I've just pushed the changes to the Comedi git repository on GitHub.
Please give them a try.
Reply all
Reply to author
Forward
0 new messages