Using the DrDaq with a Raspberry Pi 2

Post your experiences of using the Raspberry Pi with the DrDAQ
Post Reply
Raspoutine
Newbie
Posts: 0
Joined: Tue May 05, 2015 9:09 pm

Using the DrDaq with a Raspberry Pi 2

Post by Raspoutine »

I'm trying to communicate with a DrDaq using the latest pi version, the Raspberry Pi 2.

usbdrdaq library installation
The usbdrdaqlinux_0.9-1_armel driver provided by Pico Tech cannot be installed on a Raspberry Pi 2, the architecture now being armhf.
As my operating system is raspbian, I figured that I could follow the instructions relative to the debian OS:

Code: Select all

sudo bash -c 'echo "deb http://labs.picotech.com/debian/ picoscope main" >/etc/apt/sources.list.d/picoscope.list'
wget -O - http://labs.picotech.com/debian/dists/picoscope/Release.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install libusbdrdaq
This successfully installed the driver for the armhf architecture.

Small working example
So far, I've been able to compile a small working example provided by PicoTech (see USBDrDAQcon.c attached), using the following command:

Code: Select all

gcc USBDrDAQcon.c -oUSBDrDAQcon -lusbdrdaq -I /opt/picoscope/include/ -L /opt/picoscope/lib/
Now when I try the execute this code (as root for now, to avoid permission problems):

Code: Select all

sudo ./USBDrDAQcon
The communication fails with the following message:

USB DrDAQ driver example program
Version 1.0

Opening the device...
Unable to open device
Press any key


I'm not sure where to start to investigate this problem, as the sources for the usbdrdaq driver are not available.

So my question is, has anybody been successful with the DrDaq on a Raspberry Pi 2?
Attachments
linux_utils.h
(1.46 KiB) Downloaded 1186 times
USBDrDAQcon.c
(21.71 KiB) Downloaded 1195 times
Last edited by Raspoutine on Fri May 08, 2015 3:42 pm, edited 2 times in total.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

Have just tried on a freshly installed Raspberry Pi 2, logged in as pi user, using the same commands, and apart from using sudo on compile due to permissions

Code: Select all

sudo gcc USBDrDAQcon.c -oUSBDrDAQcon -lusbdrdaq -I /opt/picoscope/include/ -L /opt/picoscope/lib/
which generates a few warnings

Code: Select all

sudo ./USBDrDAQcon
runs the console application successfully.

dmesg gives

Code: Select all

[ 2743.218260] usb 1-1.4: new full-speed USB device number 4 using dwc_otg
[ 2743.321982] usb 1-1.4: New USB device found, idVendor=0ce9, idProduct=1014
[ 2743.322005] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2743.322023] usb 1-1.4: Product: PICO DEVICE
[ 2743.322040] usb 1-1.4: Manufacturer: Pico Technology
[ 2860.478891] usb 1-1.4: reset full-speed USB device number 4 using dwc_otg
please check this on your system
Martyn
Technical Support Manager

Raspoutine
Newbie
Posts: 0
Joined: Tue May 05, 2015 9:09 pm

Re: Using the DrDaq with a Raspberry Pi 2

Post by Raspoutine »

I tried to prefix the compilation command with sudo, to no avail. I'm not sure why this should fix the problem.

I crafted this really minimal working example to investigate the problem:

Code: Select all

#include 
#include 
#include 

int main(void)
{
	short g_handle;
	PICO_STATUS status;
	
	printf("About to open device\n");
	status = UsbDrDaqOpenUnit(&g_handle);
	
	if (status != PICO_OK) {
		printf("Unable to open device, error code %d\n", status);
	} else {
		printf("Device opened successfully\n");
		UsbDrDaqCloseUnit(g_handle);
	}
	
	return 0;
}
When complied with:

Code: Select all

gcc mwe.c -lusbdrdaq -I /opt/picoscope/include/ -L /opt/picoscope/lib/
and run with:

Code: Select all

sudo ./a.out
I get the following output (and the led is blinking red on the DrDaq)

Code: Select all

About to open device
Unable to open device, error code 3
which, according to PicoStatus.h, corresponds to a PICO_NOT_FOUND error.

Here is the output of dmesg when I plug the DrDaq into the Pi (which looks ok):

Code: Select all

[78169.912515] usb 1-1.4: new full-speed USB device number 26 using dwc_otg
[78170.016296] usb 1-1.4: New USB device found, idVendor=0ce9, idProduct=1014
[78170.016328] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[78170.016346] usb 1-1.4: Product: PICO DEVICE       
[78170.016364] usb 1-1.4: Manufacturer: Pico Technology
and after I run the example (which shows a USB disconnect):

Code: Select all

[78197.052736] usb 1-1.4: reset full-speed USB device number 26 using dwc_otg
[78197.325368] usb 1-1.4: USB disconnect, device number 26
[78197.562623] usb 1-1.4: new full-speed USB device number 27 using dwc_otg
[78197.666350] usb 1-1.4: New USB device found, idVendor=0ce9, idProduct=1014
[78197.666372] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[78197.666384] usb 1-1.4: Product: PICO DEVICE       
[78197.666396] usb 1-1.4: Manufacturer: Pico Technology
Any thoughts?
Is this a only strange USB permission problem?
What can I do more to investigate this further?
Attachments
mwe.c
(421 Bytes) Downloaded 1167 times

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

I downloaded and installed the Raspbian image from the Pi website this morning, is this the version you are using?

Do you have other USB devices connected?
Have you tried other ports?

I am running headless as well
Martyn
Technical Support Manager

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

Are you able to answer my previous questions ?

Additionally are you using the supplied Blue USB cable ? and the Pi's own supply?
Martyn
Technical Support Manager

Raspoutine
Newbie
Posts: 0
Joined: Tue May 05, 2015 9:09 pm

Re: Using the DrDaq with a Raspberry Pi 2

Post by Raspoutine »

Ok, I feel a little bad about this one.

I normally install raspbian using a standard procedure, but this time the SD card I bought came pre-installed with the noobs OS. As it offered to install raspbian when I first booted it, I figured it would lead to the same result.

I was wrong. Now that I wiped the card and did a fresh raspbian install, everything works great.

For future reference, the raspberry pi 2 can be used to communicate with the DrDaq without problem. Just follow the instructions from my original post. But make sure to nuke the noobs OS (if installed) and perform a fresh raspbian install.

cybersack
Newbie
Posts: 0
Joined: Wed Dec 23, 2015 12:58 pm

Re: Using the DrDaq with a Raspberry Pi 2

Post by cybersack »

Hi guys. I am new here. Could somebody please provide a download link to a compatible Raspberry PI 2 OS download ?
I assume it will be Raspian, but is the drdaq lib still soft float bound ?

mtia
Julian

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

If you use the Raspian build, you can use the armhf DrDaq lib from here
Martyn
Technical Support Manager

cybersack
Newbie
Posts: 0
Joined: Wed Dec 23, 2015 12:58 pm

Re: Using the DrDaq with a Raspberry Pi 2

Post by cybersack »

Thank you Martyn.

A second question wrt programming ... is there a Python library I can use for DrDAQ ?

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

We have no Python library at the present time
Martyn
Technical Support Manager

froens
Newbie
Posts: 0
Joined: Sun Jan 31, 2016 3:36 pm

Re: Using the DrDaq with a Raspberry Pi 2

Post by froens »

Hello there

I've followed the steps from the original post to install the required libraries.

I've downloaded the two example files and compiled them ("linux_utils.h" and "USBDrDAQcon.c") using the statement described.
When I run the program I get this message:
USB DrDAQ driver example program
Version 1.0

Opening the device...
Unable to open device
Press any key
To find out whether I'm able to see the device I've done the following:

I've added the "pi" user to the pico-group with:
sudo usermod -G pico your_username
newgrp -

Then I've tried to run the USBTEST-program located at:
/opt/picoscope/share/doc/libusbdrdaq/usbtest

This program returns the following message:
****************************************************************************
* Pico Technology Linux USB Diagnostics *
****************************************************************************

This script looks for Pico USB devices connected to your computer
and checks whether you are able to access them. If your user account
does not have permission to access the devices, the script will try
to suggest how to correct this for your particular Linux installation.

Press enter to continue...

Getting user and group information...
- You are running this script as pi.
- You are in the following groups:
pi pico

Please connect your Pico USB device and press enter to continue...

Pico USB device found: /dev/bus/usb/001/006

- It belongs to root (which is not you) who has permissions rw-
- The members of group pico (which you are in) have permissions rw-
- Everyone else has permissions r-T
- You can write to this device and so will be able to use it.
I'm using the Wheezy image found (as Martyn described) on the raspberry pi homepage (not NOOBS):
https://www.raspberrypi.org/downloads/raspbian/

What am I missing?

Best regards
Frederik

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Using the DrDaq with a Raspberry Pi 2

Post by Martyn »

Can you post the dmesg output which shows you connecting the device to the Raspberry Pi, and also when you run the application.
Martyn
Technical Support Manager

Post Reply