[Bdi4emc-help] BDI - Motenc-Lite Issue?

Paul bdi4emc at bulldoghome.com
Tue Dec 12 22:04:18 CET 2006


On Sunday 10 December 2006 22:10, Craig Gadd wrote:
> I've been working on my BDI-EMC system this weekend and came across a
> problem that I think may be software related... My setup is a
> Motenc-Lite card with a 7525 IO termination board, and a 7535 IO board.  
>
> I have my control system prototyped on a table and have been struggling to
> get any motion out of the motor(s).  I attributed the problem to my wiring
> "skills" and my proof of damaged was that vsitest.c (available on the Vital
> site) reported a "Segmentation fault" when compiled and run on BDI 4.50.

A segfault is usually caused by a null pointer - Looking at the source, line 
79 is the culprit...

  if (dev == NULL) {
      printf ("\nVendor %X Device %X\n", dev->vendor_id, dev->device_id);
      printf ("PCI Motenc Card Not Found\n");
      return -1;
    }

The first printf uses dev which will always be NULL, hence the segfault...

> Before I sent my card back, I went and down-revved BDI to version 4.38 and
> the segmentation fault error went away.  The utility seems to function
> properly allows me to communicate with the board, send voltage to the
> amplifier etc.  Any thoughts?

It looks like the the later versions of libpci require the use of 
pci_fill_info() before any data can be read from the internal structures - 
Without valid data, the tests for vendor & device ID were failing and 
triggering the segfault.. Attached is an updated vsitest.c that runs with the 
card I have here.

Abdul: The changes should be compatable with earlier versions of libpci, so 
you may want to update the MOTENC-Lite & MOTENC-100 files.. 


Regards, Paul.




More information about the Bdi4emc-help mailing list