Using more than one PICO at same time

Post general discussions on using our drivers to write your own software here
Post Reply
pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Using more than one PICO at same time

Post by pfeifelpdm »

Hi there,

thx for the help I've got from you guys. Now I have a new issue.

Since the API in windows (Driver ps4000A.dll) in .NET supports a serial number, is is quite clear that you can address an PICO using the serial number.
So far so good. For using just one of the two connected PICOs (4824) it works fine.

Now I would like to start both devices more or less same time and running.
And thus why it starts trouble.

case 1:
Pico 1 is not connected and Pico 2 is connected
I try start Pico 1 (of course it doesn't work) and afterwords I start Pico 2
Pico 2 does work fine.
make sense :-)

case 2:
Pico 1 is connected and Pico 2 is not connected
I try start Pico 1 (of course it works) and afterwords I try to start Pico 2
Until next step Pico 1 does the job.
After calling up OpenUnit for Pico 2 - the app is "freezing" and nothing happens anymore.

case 3:
Pico 1 is connected and Pico 2 is connected
I try start Pico 1 (of course it works) and afterwords I try to start Pico 2
Until next step Pico 1 does the job.
After calling up OpenUnit for Pico 2 - the app is "freezing" and nothing happens anymore.

What I do wrong.
Is it possible having 2 Picos same time running?
Btw: I did try to use OpenUnitAsync, but it didn't work : PICO_NOT_FOUND in all cases :-(.

Best Uwe

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hi Uwe,

Which version of the ps4000a.dll are you using and are both devices connected to USB 3.0 or USB 2.0 ports?

Do you see the same problem when you try using the current PicoScope 6 software to connect to each device? If so, please locate and post the trace.xml files using section 3 of the PicoScope FAQ for reference.

Regards,

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

I think it is been used the 32bit version, it is the same like in the thread topic28531.html#p97271 .

I never tried in PicoScope6, since this is not the use case, I will try.

But I tried in between working with lock() to take care that functions called only by on "client" in meaning of a thread.

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

and I use USB 3.0, but I want to use USB2.0 for some reason as well.

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

Dear Hitesh,

I did check the ability to connect both Picos via PicoScope6 Software. Connecting and recording with Pico6 and each single device - one by one - works fine, as well in the environment I wrote before.

Since I was not able to find any kind of button or menu in the PICO software, to connect and use both PICO's at same(!) time, I guess you missunderstand my messages, because I did not describe clear enough what I want to do.

I want use 2 (or may be more devices) of type 4824 to record more than 8 channels. In the currently described environment I want to record 16 channels in parallel as I described in this feed before. That means by using API and not by PICO 6 Software.

Best Uwe

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hello Uwe,

The test that I requested using the PicoScope 6 software was to check that you can connect to two devices from the same PC albeit using two separate instances of the software.

Could you please provide the following information:
  • The operating system you are using (including 32/64-bit)
  • Whether you are using USB 2.0 or 3.0 ports
  • The version of the ps4000a.dll being used
It would be helpful to see your code.

Please note that you cannot achieve true synchronisation between multiple devices.

Regards,

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

Dear Hitesh,

I do have tweo environments :
Environment 1:
In my dev env I dont have installed and don't like to install any PICO Software (PICO 6) except the SDK's.
it is an AMD FX 6core - I am quite sure it is 64 bit.
OS is Win7 Professional. Since I use AnyCpu Project I guess 32-bit dll will be used (ps4000aWrap.dll 1.0.1.22). Please note my request regarding this. Here I do use USB 3.0.

Environment 2:
PICO 6 is installed. I use USB 2.0. My own Script I did not test here.
It is Windows 7 Home - I guess 32 bit. I can use both PICO one by one. Quite clear I think.

case 1: I did open first PICO 6 instance with the choice dialog for which PICO I like to decide. While I open a second Instance of PICO 6 -> both environments start to freeze. No reaktion anymore. Just killing tasks do work. I had to reconnect both pico, to get a new PICO 6 Instance started.

case 2: I did open first Intance and choose one of the PICO's. After that I started the second instance. But now no dialog occured. Just connected to the current running PICO in the first instance.

Here yu will find the code. I use factory pattern to handle bot PICO same code. As long tested in environment 1.

Code: Select all

public static StreamingCon CreateStreamConnection(vo.Configuration configuration, String serialNumber = null)
        {
            StreamingCon returnValue = null;
            short handle = 0;
            
            Console.WriteLine("C# PS4000A driver streaming example program");
            Console.WriteLine("Version 1.2\n\r");

            // Open unit and show splash screen
            Console.WriteLine("\n\rOpening the device...");
            PICO_INFO status = 0;

            StringBuilder sr = null; // new StringBuilder("ET306/022");
            if (serialNumber != null && !serialNumber.Equals(""))
            {
                sr = new StringBuilder();
                sr.Append(serialNumber);
            }
            
            try
            {
                status = (PICO_INFO)Imports.OpenUnit(out handle, sr);
                //status = (PICO_INFO)Imports.OpenUnitAsync(out handle, sr);
                short progress = 0, complete = 0;
                Console.WriteLine("opening unit [{0}] status : {1} handle {2} ", sr, status.ToString(), handle);

                //do
                //{
                //    status = (PICO_INFO)Imports.OpenUnitProgress(out handle, out progress, out complete);
                //    Console.WriteLine("unit [{0}] status : {1} handle {2} progress {3} complete {4}", sr, status.ToString(), handle, progress, complete);
                //    Thread.Sleep(400);
                //} while (status == 0);

                //Console.WriteLine("Success ! Unit [{0}] status : {1} handle {2} progress {3} complete {4}", sr, status.ToString(), handle, progress, complete); 
                
                if (status != 0 && handle != 0)
                {
                    status = (PICO_INFO)Imports.ps4000aChangePowerSource(handle, (uint)status);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("cannot connect to device. See " + ex.ToString());
                return null;
            }

            if (status != 0)
            {
                Console.WriteLine("Unable to open device");
                Console.WriteLine("Error code : {0}", status);
                // WaitForKey();
            }
            else
            {
                Console.WriteLine("Device opened successfully\n");

                StreamingCon consoleExample = new StreamingCon(handle, configuration);
                consoleExample.handle = handle;
                consoleExample.ConnectionState = status;
                returnValue = consoleExample;
            }

            return returnValue;
        }

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hi Uwe,

Have you installed the latest chipset drivers for your USB 3.0 ports?

Have you tried using a powered USB hub?

Regards,

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

I would expect, that the drivers are updtodate .. for the dev environment i am sure.
The powered USB device, I have to try out.

thx

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hi Uwe,

Please provide an update when you have tested this.

Thanks,

Hitesh

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

Dear Hitesh,

now I had the possibility to test with USB 3.0 and a separate powered USB Hub.
Again as that moment the 2nd PICO will be start the stream the Application freezes (I am sure in the PicoInterface Library).

I did an separate Test with a defined lock Mechanism inside PicoInterface as I allready did before (but with USB 2.0/USB 3.0 w/o own power setup). That means it is guarateed that the Pico Library is been used by the Application itself only once.

PicoInterface

Code: Select all

public class Imports
    {
        #region constants
        private const string _DRIVER_FILENAME = "ps4000A.dll";

        public const int MaxValue = 32767;

        public const int SIG_GEN_BUFFER_SIZE = 16384;

        public const Int64 AWG_PHASE_ACCUMULATOR = 4294967296;

        public const int AWG_DAC_FREQUENCY = 80000000;

        public static Object myLock = new Object();

        #endregion
Example usage

Code: Select all

lock (Imports.myLock)
                    {
                        status = (PICO_INFO)Imports.RunStreaming(_handle, ref sampleInterval, sampleTimeUnits, maxPreTriggerSamples, maxPostTriggerSamples,
                                            setAutoStop, downSampleRatio, Imports.DownSamplingMode.None, (uint)tempBufferSize);
                        lastError = Marshal.GetLastWin32Error();
                        //if (lastError > 0) throw new Exception("Error " + lastError + " occured");
                    }

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hi Uwe,

Could you please e-mail your code to support@picotech.com and we can try testing it here.

Thanks,

pfeifelpdm
Newbie
Posts: 1
Joined: Tue Feb 14, 2017 3:12 pm

Re: Using more than one PICO at same time

Post by pfeifelpdm »

Dear Hitesh,

thx for your help. I think I figured out the problem. The reason was, that both independent Streaming Objects did output some Console log to the same FileStreamObject which owner is another Thread like printing to GUI Elements within parallel processes / threads.
I did disable the console logs and now both PICO may do their work (since the led is green) ;-).

Best Uwe

Hitesh

Re: Using more than one PICO at same time

Post by Hitesh »

Hello Uwe,

Good to hear you resolved the issue :D

Regards,

Post Reply