Discussion:
[Linux-gpib-general] attach / detach functions
Ralf Gorholt
2017-01-02 10:37:19 UTC
Permalink
Dear list members,

before I ask for your help, I would like to wish you all a happy and
peaceful year 2017.

I have developed a USB GPIB interface based on a TMS9914 interface chip
and an ATMEGA162 microcontroller. As far as I can tell up to now, the
interface works. When I use it on Windows with the FTDI device driver
(ftd2xx), I can control my signal generator. Now I would like to get it
to work with linux-gpib.

I have seen that a driver module exists for the USB interface that has
been developed at the university of Ljubljana (lpvo_usb_gpib) and I
would like to take this as an example for my own driver development.
Unfortunately, I have not done any development on Linux yet and so my
knowledge is quite limited here.

In the lpvo_usb_gpib module, I have found a table with all the functions
that a GPIB interface should provide. To see which function is called
and when, I have currently replaced the body of all interface functions with

printk(KERN_ALERT "%s:%s - currently a NOP\n", HERE);

I can load and unload my driver module and see the corresponding
messages in /var/log/syslog and /var/log/messages. But what I do not see
is the execution of the attach and detach functions when I call
gpib_config. The only message I see when I call gpib_config is "gpib0:
exiting autospoll thread". Shouldn't they be called when I call
gpib_config? If not, when are attach and detach called?

Perhaps somebody can point me in the right direction. Any help is
appreciated. But, please don't forget that for me everything concerning
Linux development is really new.

Thank you very much for your help!

Kind regards,

Ralf (DL5EU)
carla
2017-01-02 12:10:22 UTC
Permalink
Dear Ralf

when you say you have replaced the body of all interface functions
with
printk(KERN_ALERT "%s:%s - currently a NOP\n", HERE);

do you mean the usb_gpib_attach() and usb_gpib_detach() functions also?

In that case you can obtain only that message and nothing more.

Try leaving untouched the usb_gpib_attach()/usb_gpib_detach()
functions, compile with

#define ENABLE_DIA_LOG 1

at line 127 and follow the procedure (as root):

modprobe lpvo_usb_gpib
stty raw -echo -iexten -F /dev/ttyUSB0
gpib_config -t lpvo_usb_gpib -m 0

(I suppose the adapter is on /dev/ttyUSB0).

In the log you should get something like this:

gpib: registered lpvo_usb_gpib interface
lpvo_usb_gpib:usb_gpib_init_module - done
lpvo_usb_gpib:usb_gpib_attach configuring lpvo_usb_gpib#0 as ttyUSB0
lpvo_usb_gpib:usb_gpib_attach - found ffff88009f553a00 0
lpvo_usb_gpib:usb_gpib_attach - # - board ffffffffa0454380
lpvo_usb_gpib:usb_gpib_attach - # - buffer_length 16384
lpvo_usb_gpib:usb_gpib_attach - # - status 20
lpvo_usb_gpib:usb_gpib_attach - # - use_count 1
lpvo_usb_gpib:usb_gpib_attach - # - pad 0
lpvo_usb_gpib:usb_gpib_attach - # - sad ffffffa0
lpvo_usb_gpib:usb_gpib_attach - # - timeout 3000000
lpvo_usb_gpib:usb_gpib_attach - # - ppc 0
lpvo_usb_gpib:usb_gpib_attach - # - t1delay 0
lpvo_usb_gpib:usb_gpib_attach - # - online 0
lpvo_usb_gpib:usb_gpib_attach - # - autopoll 0
lpvo_usb_gpib:usb_gpib_attach - # - autopoll task (null)
lpvo_usb_gpib:usb_gpib_attach - # - minor 0
lpvo_usb_gpib:usb_gpib_attach - # - master 1
lpvo_usb_gpib:usb_gpib_attach - # - list 0
lpvo_usb_gpib:usb_gpib_attach - USB_GPIB_ON returns 6

In the last line the returned code should be different from 6,
some message code should follow and usb_gpib_detach() be invoked,
this depends upon the way your adapter behaves. Try and let me know.

Good luck and happy new year

Marcello Carla'




On 01/02/2017 11:37 AM, Ralf Gorholt wrote:
> Dear list members,
>
> before I ask for your help, I would like to wish you all a happy and
> peaceful year 2017.
>
> I have developed a USB GPIB interface based on a TMS9914 interface chip
> and an ATMEGA162 microcontroller. As far as I can tell up to now, the
> interface works. When I use it on Windows with the FTDI device driver
> (ftd2xx), I can control my signal generator. Now I would like to get it
> to work with linux-gpib.
>
> I have seen that a driver module exists for the USB interface that has
> been developed at the university of Ljubljana (lpvo_usb_gpib) and I
> would like to take this as an example for my own driver development.
> Unfortunately, I have not done any development on Linux yet and so my
> knowledge is quite limited here.
>
> In the lpvo_usb_gpib module, I have found a table with all the functions
> that a GPIB interface should provide. To see which function is called
> and when, I have currently replaced the body of all interface functions with
>
> printk(KERN_ALERT "%s:%s - currently a NOP\n", HERE);
>
> I can load and unload my driver module and see the corresponding
> messages in /var/log/syslog and /var/log/messages. But what I do not see
> is the execution of the attach and detach functions when I call
> gpib_config. The only message I see when I call gpib_config is "gpib0:
> exiting autospoll thread". Shouldn't they be called when I call
> gpib_config? If not, when are attach and detach called?
>
> Perhaps somebody can point me in the right direction. Any help is
> appreciated. But, please don't forget that for me everything concerning
> Linux development is really new.
>
> Thank you very much for your help!
>
> Kind regards,
>
> Ralf (DL5EU)
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-gpib-general mailing list
> Linux-gpib-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>


--
Marcello Carla' - ***@fi.infn.it
University of Florence - Dept. of Physics
Via G. Sansone 1 - I 50019 Sesto F. (Firenze) Italy
Tel.: 39 055 457 2055/2013/2060
Ralf Gorholt
2017-01-03 08:54:52 UTC
Permalink
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
carla
2017-01-03 11:42:11 UTC
Permalink
Dear Ralf

if I am not wrong, gpib_config asserts REN if so requested
(option --sre) or by default, but does not deassert REN if
the --no-sre option is given. I deduced an interface has to
to be started with REN off.

Please, Dave, is that right?

Thanks

Marcello Carla'




On 01/03/2017 09:54 AM, Ralf Gorholt wrote:
> Dear Marcello,
> in your driver I have found a comment that REN has to be kept off after
> IFC because the "core" assumes this behaviour. In my interface I have
> currently nothing implemented like this and that's why I have two questions:
> 1) What is the "core"? The common and device independent part of linux-gpib?
> 2) Can you or anybody else tell me why REN may or may not be asserted
> with IFC or kept on or off after IFC ? I thought that these lines were
> independent but I am lacking experience with the GPIB. Perhaps this is
> already explained somewhere in a documentation but I have collected so
> many documents that I probably won't find it.
> Thank you very much and kind regards,
> Ralf
> *Gesendet:* Montag, 02. Januar 2017 um 13:10 Uhr
> *Von:* carla <***@fi.infn.it>
> *An:* linux-gpib-***@lists.sourceforge.net
> *Betreff:* Re: [Linux-gpib-general] attach / detach functions
> Dear Ralf
>
> when you say you have replaced the body of all interface functions
> with
> printk(KERN_ALERT "%s:%s - currently a NOP\n", HERE);
>
> do you mean the usb_gpib_attach() and usb_gpib_detach() functions also?
>
> In that case you can obtain only that message and nothing more.
>
> Try leaving untouched the usb_gpib_attach()/usb_gpib_detach()
> functions, compile with
>
> #define ENABLE_DIA_LOG 1
>
> at line 127 and follow the procedure (as root):
>
> modprobe lpvo_usb_gpib
> stty raw -echo -iexten -F /dev/ttyUSB0
> gpib_config -t lpvo_usb_gpib -m 0
>
> (I suppose the adapter is on /dev/ttyUSB0).
>
> In the log you should get something like this:
>
> gpib: registered lpvo_usb_gpib interface
> lpvo_usb_gpib:usb_gpib_init_module - done
> lpvo_usb_gpib:usb_gpib_attach configuring lpvo_usb_gpib#0 as ttyUSB0
> lpvo_usb_gpib:usb_gpib_attach - found ffff88009f553a00 0
> lpvo_usb_gpib:usb_gpib_attach - # - board ffffffffa0454380
> lpvo_usb_gpib:usb_gpib_attach - # - buffer_length 16384
> lpvo_usb_gpib:usb_gpib_attach - # - status 20
> lpvo_usb_gpib:usb_gpib_attach - # - use_count 1
> lpvo_usb_gpib:usb_gpib_attach - # - pad 0
> lpvo_usb_gpib:usb_gpib_attach - # - sad ffffffa0
> lpvo_usb_gpib:usb_gpib_attach - # - timeout 3000000
> lpvo_usb_gpib:usb_gpib_attach - # - ppc 0
> lpvo_usb_gpib:usb_gpib_attach - # - t1delay 0
> lpvo_usb_gpib:usb_gpib_attach - # - online 0
> lpvo_usb_gpib:usb_gpib_attach - # - autopoll 0
> lpvo_usb_gpib:usb_gpib_attach - # - autopoll task (null)
> lpvo_usb_gpib:usb_gpib_attach - # - minor 0
> lpvo_usb_gpib:usb_gpib_attach - # - master 1
> lpvo_usb_gpib:usb_gpib_attach - # - list 0
> lpvo_usb_gpib:usb_gpib_attach - USB_GPIB_ON returns 6
>
> In the last line the returned code should be different from 6,
> some message code should follow and usb_gpib_detach() be invoked,
> this depends upon the way your adapter behaves. Try and let me know.
>
> Good luck and happy new year
>
> Marcello Carla'
>
>





--
Marcello Carla' - ***@fi.infn.it
University of Florence - Dept. of Physics
Via G. Sansone 1 - I 50019 Sesto F. (Firenze) Italy
Tel.: 39 055 457 2055/2013/2060
dave penkler
2017-01-02 15:03:09 UTC
Permalink
Just to confirm that attach is called when gpib_config tries to bring the
board on-line.


Happy new year to all linux-gpib users.
/d

On Mon, Jan 2, 2017 at 11:37 AM, Ralf Gorholt <***@gmx.de> wrote:

> Dear list members,
>
> before I ask for your help, I would like to wish you all a happy and
> peaceful year 2017.
>
> I have developed a USB GPIB interface based on a TMS9914 interface chip
> and an ATMEGA162 microcontroller. As far as I can tell up to now, the
> interface works. When I use it on Windows with the FTDI device driver
> (ftd2xx), I can control my signal generator. Now I would like to get it
> to work with linux-gpib.
>
> I have seen that a driver module exists for the USB interface that has
> been developed at the university of Ljubljana (lpvo_usb_gpib) and I
> would like to take this as an example for my own driver development.
> Unfortunately, I have not done any development on Linux yet and so my
> knowledge is quite limited here.
>
> In the lpvo_usb_gpib module, I have found a table with all the functions
> that a GPIB interface should provide. To see which function is called
> and when, I have currently replaced the body of all interface functions
> with
>
> printk(KERN_ALERT "%s:%s - currently a NOP\n", HERE);
>
> I can load and unload my driver module and see the corresponding
> messages in /var/log/syslog and /var/log/messages. But what I do not see
> is the execution of the attach and detach functions when I call
> gpib_config. The only message I see when I call gpib_config is "gpib0:
> exiting autospoll thread". Shouldn't they be called when I call
> gpib_config? If not, when are attach and detach called?
>
> Perhaps somebody can point me in the right direction. Any help is
> appreciated. But, please don't forget that for me everything concerning
> Linux development is really new.
>
> Thank you very much for your help!
>
> Kind regards,
>
> Ralf (DL5EU)
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-gpib-general mailing list
> Linux-gpib-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>
Continue reading on narkive:
Loading...