USB experimentation board – part 1

VK8055I bought and assembled this Velleman K8055 kit (quite) a while ago. It’s an USB experiment board. Under windows it all works quite nicely; but under Linux I have been unable to compile the demo program.

The demo program consists of two parts: a library called libk8055 and the Linux clone of the Velleman demo interface.

Compiling the library was pretty straightforward, and the accompanying command line tool worked too.  Compiling the demo interface program did not work, at first because I was missing wxWidget libraries, secondly because there was a function not documented in the header file of the library, and thridly because the linker can’t find or read the library file.  I haven’t found a solution for that last problem just yet.  I tried adjusting the installation script to install the files in the default ubuntu locations, but this didn’t solve it.  I tried messing with compile options, I tried static linking, dynamic linking, a whole set of compile options, but it just wouldn’t link…

I’ll try again later, when I find the courage to dive deeper into the sources.  I’ll also try to get the bugfixes upstream once I finalise them.

10 Replies to “USB experimentation board – part 1”

  1. Thanks, mate 🙂
    But I don’t have anything new on the drawing board right now, just thinking about allocating some more spare time getting this USB board library to work on Linux.

  2. You got the libk8055 working under interpid? I was more lucky with wxWidgets though. They did complile, but I have still problems with libk8055, it is compiled, installed, only it does not want to work.

    I don’t know if it is hotplug, lsusb recognize the board but the command line progam not.

  3. yeah, I did use Ubuntu Intrepid for this, and compiling the libk8055 was not a problem once I found the correct wxWidgets libraries to install first.
    The command line program that came with the library did work straight out of the box. I’ll look up the commands I’ve tried this evening if that helps.

  4. Please do this. Commandline now works with root access, but this is not the proper way.

    In the mean time I am too trying to revive k8055gui. It looks promising, but in my case it stops due to missing (which is not missing!)

  5. in the k8055.h you need to add the following line:
    int ReadAllValues(long int *data1, long int * data2, long int * data3, long int * data4, long int * data5);

    for some reason this line is missing…
    secondly we need to find a way to link the library to the gui program… I still haven’t found a solution for this. I have checked how the command line program is linked, but this is linked statically instead of the preferred dynamic linking.

    I used this command line to test the library:
    k8055 -p:0 -d:147 -a1:25 -a2:203

    You might need to change the access rights to the USB device if you require root privileges.

  6. This is what I get when I try to compile the gui program

    $ make
    g++ `wx-config –libs` -o k8055gui MyApp.o MyFrame.o -lusb -lm -lk8055
    MyFrame.o: In function `MyFrame::WriteDigital()’:
    MyFrame.cpp:(.text+0x16fa): undefined reference to `WriteAllDigital(long)’
    MyFrame.o: In function `MyFrame::WriteAnalog()’:
    MyFrame.cpp:(.text+0x1c65): undefined reference to `OutputAllAnalog(long, long)’
    MyFrame.o: In function `MyFrame::WriteDebounce2()’:
    MyFrame.cpp:(.text+0x1ea4): undefined reference to `SetCounterDebounceTime(long, long)’
    MyFrame.o: In function `MyFrame::WriteDebounce1()’:
    MyFrame.cpp:(.text+0x1f7e): undefined reference to `SetCounterDebounceTime(long, long)’
    MyFrame.o: In function `MyFrame::WriteAll()’:
    MyFrame.cpp:(.text+0x20ec): undefined reference to `WriteAllDigital(long)’
    MyFrame.cpp:(.text+0x213a): undefined reference to `OutputAllAnalog(long, long)’
    MyFrame.o: In function `MyFrame::OnIdle(wxIdleEvent&)’:
    MyFrame.cpp:(.text+0x2204): undefined reference to `ReadAllValues(long*, long*, long*, long*, long*)’
    MyFrame.o: In function `MyFrame::OnBnClickedResct2(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0x2459): undefined reference to `ResetCounter(long)’
    MyFrame.o: In function `MyFrame::OnBnClickedResct1(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0x24a9): undefined reference to `ResetCounter(long)’
    MyFrame.o: In function `MyFrame::OnBnClickedConnect(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0x2524): undefined reference to `OpenDevice(long)’

  7. I just found the solution, mate.

    The code of the GUI was written C++, while the library was written in C. Normally the header file of the library should contain something like this at the top:
    #ifdef __cplusplus
    extern “C” {

    and this at the bottom:
    #ifdef __cplusplus

    To solve this the quick and dirty way: in MyFrame.cpp, you replace
    extern “C” {

    and you’re all set

  8. Hoy!

    You are great! The adding of the ReadAllValues function into the header file of h8055.h did it for me! The other thing was not necessary since the required extern C command was already included in the libk8055 version 3.1 (yes it a mess on the project dwnl page). Now only the god access. 😉

  9. I didn’t know that there was a newer version of the libk8055 library, thanks for the information 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *