usb connection

Post your C and C++ discussions here
Post Reply
fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

usb connection

Post by fernandoluiz »

sometime my picoscope lock your connection with the PC and i would like of know if exixsts any sample in C/C++ that cut the this connection of usb port and after reset this connection

thanks

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: usb connection

Post by ziko »

Hi what device are you using and is does this happen when using our software?

Kind regards
Ziko

Technical Specialist

fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

Re: usb connection

Post by fernandoluiz »

i'm using pico3205 e pico3206, sometimes its broke your connection with the pc when i used my software and the software picoscope6.because i would like developing a software that cut the connection and after restart that connection

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: usb connection

Post by Chris »

If you can let us know what you are doing when the connection gets broken, we can look into the issue.

fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

Re: usb connection

Post by fernandoluiz »

when the broken, i disconnect the hardware and then i put again, and the hardware return the work.but the hardware should not stop.

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

Re: usb connection

Post by Martyn »

Without further details of exactly what is happening when the unit stops responding to your software it is difficult to offer a solution to your problem.

If you wanted to create a workaround you may be able to add a watchdog to your application which will call CloseUnit to close the connection to the device and then create a new handle to the device by calling OpenUnit.
Martyn
Technical Support Manager

fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

Re: usb connection

Post by fernandoluiz »

how i do this

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

Re: usb connection

Post by Martyn »

Periodically ask the scope for some simple information, for example device serial number, and if you don't get any data back just close the unit before opening it again. I can't be more specific without more details of your software so can't guarantee that this would work.
Martyn
Technical Support Manager

stefanwiesner
Newbie
Posts: 0
Joined: Sat Feb 27, 2010 1:51 pm

Re: usb connection

Post by stefanwiesner »

I have the same problem with my picoscope 2203. It sometimes (it is hard to reproduce and find a pattern, sometimes after 10 minutes, sometimes after 2 days) looses the connection to the PC, meaning the picoscope is not found by any application (picoscope 6 software, or my own little app) anymore. In order to get it back, i have to unplug the usb connection and plug it again, or restart the PC.

My little app, that causes the crash does the following:

Code: Select all

// activate wave generator
ps2000_set_sig_gen_built_in (...)

ps2000_set_channel(m_handle, PS2000_CHANNEL_A, true, false, rangeps)
ps2000_set_trigger(m_handle, PS2000_NONE, 0, 0, 0, 0)

// start streaming
m_samplingInterval = 1;
m_localBufferSize = 250000;
ps2000_run_streaming_ns (m_handle, m_samplingInterval, PS2000_US, m_localBufferSize,  0, 1, 150000)

// read data
while (ps2000_get_streaming_last_values(m_handle, ps2000FastStreamingReady) == 0)
{
     // copy data from the buffer and do some stuff
}
It basically streams the whole time data from the picoscope and does some anlysis on the data.

Are there some known issues with USB 1.0, 2.0 or 3.0? Do I have to set something special when i do long time streaming?

Thanks already in advance for your help, best
Stefan

fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

Re: usb connection

Post by fernandoluiz »

in my program i use run_block() and i have the some problem

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

Re: usb connection

Post by Martyn »

Stefan, Do you know where your application gets stuck ?

Fernando, I have replied through our helpdesk ticketing system.
Martyn
Technical Support Manager

fernandoluiz
Newbie
Posts: 0
Joined: Wed Dec 15, 2010 6:13 pm

Re: usb connection

Post by fernandoluiz »

yes i already see your email

stefanwiesner
Newbie
Posts: 0
Joined: Sat Feb 27, 2010 1:51 pm

Re: usb connection

Post by stefanwiesner »

Unfortunately I cant see where and when the program gets stuck and it is hard to reproduce. What basically happens, is that I lose the usb connection to the picoscope and the call to get_streaming_last_values_ns gets stuck. When I then restart the PC I sometimes get the windows message, that the picoscope could not be initialized. After switching off and on the PC a second time the picoscope is detected again.

Is it possible, that streaming with one microsecond sampling interval over a longer period of time is too much for the picoscope?

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

Re: usb connection

Post by Martyn »

Streaming at that rate shouldn't cause an issue for the device, so the problem is more likely to reside with the use of resources by the driver and/or the application, particularly if other applications/services are running on the PC. One suggestion would be to disable as much as possible, including removing unused USB hardware and see if the time before lock up changes significantly.
Martyn
Technical Support Manager

Post Reply