# DeviceSetupFailure Automation Analog Capture

**URL:** <https://discuss.saleae.com/t/devicesetupfailure-automation-analog-capture/3091>\
**Category:** Support\
**Created:** [October 8, 2024, 9:28am UTC](https://discuss.saleae.com/t/devicesetupfailure-automation-analog-capture/3091 "2024-10-08T09:28:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![am1](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@am1](https://discuss.saleae.com/u/am1)\
**Post date:** [October 8, 2024, 9:28am UTC](https://discuss.saleae.com/t/devicesetupfailure-automation-analog-capture/3091/1 "2024-10-08T09:28:21Z")

</div>

The code below regularly crashes, if I let it run for a couple of minutes. It never reached 10min so far. I’d like to run it for a couple of hours. Why could it be that the Device Setup fails? Any suggestion would be appreciated.

Code:  
#########################################################  
with automation.Manager.connect(port=10430) as manager:  
dev\_conf = automation.LogicDeviceConfiguration(  
enabled\_analog\_channels=[0],  
analog\_sample\_rate=625000,  
)  
cap\_conf = automation.CaptureConfiguration(  
capture\_mode=automation.TimedCaptureMode(duration\_seconds=T\_sample)  
)  
abs\_path = ‘C:\work\git\vinsontruck-python-tools\scripts\out\’  
with manager.start\_capture(device\_configuration=dev\_conf,  
capture\_configuration=cap\_conf) as capture:  
capture.wait()  
capture.export\_raw\_data\_csv(abs\_path, analog\_channels=[0])  
ntc\_dat = pd.read\_csv(abs\_path + ‘analog.csv’)  
ntc\_u\_arr = ntc\_dat[“Channel 0”].to\_numpy()  
u\_mean = np.mean(ntc\_u\_arr)  
u\_std = np.std(ntc\_u\_arr)  
return (u\_mean, u\_std)  
#########################################################  
Error (last view lines of terminal ouput, the two numbers are just u\_mean and time):  
INFO:saleae.automation.manager:sub ChannelConnectivity.IDLE  
INFO:saleae.automation.manager:sub ChannelConnectivity.CONNECTING  
INFO:saleae.automation.manager:sub ChannelConnectivity.READY  
2.72  
487.97  
INFO:saleae.automation.manager:sub ChannelConnectivity.IDLE  
INFO:saleae.automation.manager:sub ChannelConnectivity.CONNECTING  
INFO:saleae.automation.manager:sub ChannelConnectivity.READY  
2.72  
496.55  
INFO:saleae.automation.manager:sub ChannelConnectivity.CONNECTING  
INFO:saleae.automation.manager:sub ChannelConnectivity.READY  
Traceback (most recent call last):  
File “c:/…/scripts/MWE.py”, line 44, in   
(u\_ntc, std\_ntc) = getNTCu(T\_sample\_ntc)  
File “c:/…/scripts/MWE.py”, line 17, in getNTCu  
with manager.start\_capture(device\_configuration=dev\_conf, capture\_configuration=cap\_conf) as capture:  
File “C:.…\lib\site-packages\saleae\automation\manager.py”, line 583, in start\_capture  
reply: saleae\_pb2.StartCaptureReply = self.stub.StartCapture(  
File “C:\Program Files\WinPython38\_64bit\python-3.8.6.amd64\lib\contextlib.py”, line 131, in **exit**  
self.gen.throw(type, value, traceback)  
File “C:.…\lib\site-packages\saleae\automation\errors.py”, line 121, in \_error\_handler  
raise grpc\_error\_to\_exception(exc) from None  
saleae.automation.errors.DeviceError: Error interacting with device during capture: DeviceSetupFailure.

I am using windows 11, Python 3.8.6 in VS Code 194.0, Logic 2.4.14, Logic 8 hardware, USB cable directly connected to mainboard of laptop, I tried both laptop USB ports  
Thank you for your help

---

<div class="post-metadata">

**Author:** ![BitBob](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/bitbob/32/2292_2.png) [@BitBob](https://discuss.saleae.com/u/BitBob)\
**Post date:** [October 9, 2024, 1:35am UTC](https://discuss.saleae.com/t/devicesetupfailure-automation-analog-capture/3091/2 "2024-10-09T01:35:04Z")

</div>

My guess would be you might be having some USB intermittent issues. Does it happen if PC stays ‘busy’ (i.e., actively using PC keyboard/mouse while script is running vs. console is essentially ‘idle’ other than the script?) Does the `Logic 2.exe` process hang/crash in Task Manager?

**Quick tips:**

- Make sure the Logic is only device on USB, if possible  
(no other USB devices connected/in use)
- Make sure PC is on AC vs. battery power  
(set on full/high performance, not battery/lower power optimized)
- Make sure USB port won’t go to sleep  
(Turn off all USB power saving options, so ‘always on’ and Windows won’t disable/power off port)
- Try the same script on a different PC (if possible, a different model) and see if you get the same result

**More possible links w/ ideas to try:**

- device setup failure  
[Error Message: DeviceSetupFailure | Saleae Support](https://support.saleae.com/troubleshooting/device-setup-failure)
- USB timeout (for tips on improving USB connection)  
[Error Message: ReadTimeout | Saleae Support](https://support.saleae.com/troubleshooting/device-not-able-to-keep-up)
- Longer page on some old/prior USB issues (seems more for Linux, but some ideas may help/apply in general or on Windows)  
[Device Disconnected Error](https://discuss.saleae.com/t/device-disconnected-error/1193)
