Test and Measurement Forum

SDK for Linux

Post your Linux discussions here

SDK for Linux

Postby DaveHughes » Thu Jun 25, 2015 1:36 pm

Hello,

I have installed the new PicoScope software on my Ubuntu system, and have it all running fine (can see traces etc through my PS6000).

However, I can't seem to get my own software to compile anymore? I used to be able to write my own C++ programs that made use of the drivers, but this isn't working now... Am I missing something?
With a simple Main.cpp of:
Code: Select all
#include <iostream>
using namespace std;
#include <sys/types.h>
#include <string.h>

#include <libps6000-1.4/ps6000Api.h>
#include <libps6000-1.4/PicoStatus.h>

int main()
{
   PICO_STATUS ret;   
   short psHndl;   
   bool psOpen;
   ret=ps6000OpenUnit(&psHndl,NULL);
   if(ret==PICO_OK)
   {
      cout<<"Picoscope opened.\n";
      psOpen=true;
   }else
   {
      cout<<"Problem! "<<ret<<"\n";
      return 1;
   };
   return 0;
};


doing the command:
gcc -I/opt/picoscope/include/ -L/opt/picoscope/lib main.cpp -lps6000

Gives the error:
/usr/bin/ld: /tmp/cc9WXO3N.o: undefined reference to symbol '_ZSt4cout@@GLIBCXX_3.4'
/usr/lib/i386-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status


Can anyone give me advise on how to use the new PicoScope installation for developing software?
DaveHughes
Newbie
 
Posts: 0
Joined: Mon Jul 01, 2013 1:43 pm

Re: SDK for Linux

Postby Hitesh » Wed Jul 01, 2015 3:26 pm

Hi Dave,

Are you able to build the example provided as part of the libps6000 package successfully?

Regards,
Hitesh

Technical Support Engineer
Hitesh
Site Admin
Site Admin
 
Posts: 2495
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: SDK for Linux

Postby mario_ » Wed Aug 19, 2015 2:45 pm

The solution is to use g++ instead of gcc... g++ compiles cpp, gcc just c. g++ will link stdc++ where missing symbols exists. Also option `-o main` will produce correct executable.
mario_
Site Admin
Site Admin
 
Posts: 112
Joined: Fri Sep 13, 2013 12:57 pm

Re: SDK for Linux

Postby DaveHughes » Thu Nov 12, 2015 11:53 am

Sorry for the belated replies (I switched to g++ before checking back here!), thanks for you help!
DaveHughes
Newbie
 
Posts: 0
Joined: Mon Jul 01, 2013 1:43 pm

Re: SDK for Linux

Postby rjm » Wed Aug 16, 2017 3:12 pm

Many thanks for this thread. This seems the only information available regarding direct control of picoscope.
I see that SDK is for Windows only, so I thought that no direct communication is presumed in Linux, until I found this thread...
Please add some related documents onto the website!!

I'm having a PS5000a-compatible instrument (5443A)

My code example in C, adapted from the thread:

Code: Select all
// compile command:
// gcc -I/opt/picoscope/include/ -L/opt/picoscope/lib picotest.c -lps5000a -o picotest

#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
#include <string.h>

#include <libps5000a-1.1/ps5000aApi.h>
#include <libps5000a-1.1/PicoStatus.h>

int main(void)
{
   PICO_STATUS ret;   
   short psHndl;   
   char psOpen;
   ret=ps5000aOpenUnit(&psHndl,NULL,PS5000A_DR_12BIT);
   if(ret==PICO_OK)
   {
      printf("Picoscope opened.\n");
      psOpen=1;
   }else
   {
      printf("Problem! %d\n", ret);
      return 1;
   };
   return 0;
};


However, a problem with return value 3 is reported.
rjm
Newbie
 
Posts: 0
Joined: Sun Mar 01, 2009 10:11 pm

Re: SDK for Linux

Postby Hitesh » Wed Aug 16, 2017 4:26 pm

Hi rjm,

Is the PicoScope application running at the same time as your application? If so, please close it down and then try again.

We are looking to change the content of our [url]Linux Software and Drivers for Oscilloscopes and Data Loggers[/url] page so there will be further information.We do provide instructions on how to install the driver packages.

You may wish to try the C console application from our GitHub repository.

Regards,
Hitesh

Technical Support Engineer
Hitesh
Site Admin
Site Admin
 
Posts: 2495
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: SDK for Linux

Postby rjm » Wed Aug 16, 2017 4:51 pm

Thanks for the quick reply, and yes, I decided to download the SDK, and find out that this kit is quite generic. Before I read your answer, I already found the console application, an built in successfully on my system. It works! - but not after having inspected the power connection from the adapter. It seems that electrical contact was not OK (or was the PS hanging?).

To be sure, I also executed the small test program of this thread - is okay now.

The console application is a good basic point for further work. I'd construct a simple approach (nonverbose) that acts like instruments out there that can be controlled via a set of commands over the communications line. In this case: via piping from whatever application as if it were a cabled command interface.

First (priority) thing for me is to transfer 32 Msamples of 100MSPS data captured data from the PS buffer into a simply binary data file (I hope the PS can send the buffer content in byte binary format (8-bit samples) to the host in order to minimize time associated with the transfer over USB.
rjm
Newbie
 
Posts: 0
Joined: Sun Mar 01, 2009 10:11 pm

Re: SDK for Linux

Postby Hitesh » Fri Aug 18, 2017 8:47 am

Hi rjm,

Thank you for your reply.

If you are having trouble with the USB cable/power supply please e-mail support@picotech.com and we can assist you further.

Please feel free to submit a pull request on our GitHub repository if you wish to contribute some example code (create a new project under the ps5000a folder).

Are you using 8-bit resolution or higher?

Regards,
Hitesh

Technical Support Engineer
Hitesh
Site Admin
Site Admin
 
Posts: 2495
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to Linux

Who is online

Users browsing this forum: No registered users and 0 guests