SivyerLab / pyCrafter4500

Python USB controller for the TI LCR4500EVM
https://pycrafter4500.readthedocs.io/en/latest/
GNU General Public License v3.0
16 stars 16 forks source link

Error while running pycrafter commands #8

Closed nikhil4595 closed 5 years ago

nikhil4595 commented 5 years ago

Hi,

For some reason, I keep getting a fixed set of errors everytime I try to run a few lines to project a pattern sequence for images in the flash of the DLP.

This is what I tried to excecute

import pycrafter4500 as py

import usb.core
import usb.util
import pylibusb
import pyhidapi

py.power_up()
dlp = py.dlpc350(device=usb.core.find(idVendor=0x0451, idProduct=0x6401))
dlp.set_display_mode(mode='pattern')
dlp.set_pattern_input_source(mode='flash')
py.pattern_mode(num_pats=2,period=222,bit_depth=7,led_color=0b111)

And this is the error that pops up everytime :

"C:\Program Files\Python36\python.exe" C:/Users/z003kpue/PycharmProjects/untitled2/dlpcontrol.py USB Error: [Errno 10060] Operation timed out Exception ignored in: <bound method _AutoFinalizedObjectBase.del of <usb.backend.libusb1._Device object at 0x000002CB2E8D9CC0>> Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\usb_objfinalizer.py", line 84, in del self.finalize() File "C:\Program Files\Python36\lib\site-packages\usb_objfinalizer.py", line 144, in finalize self._finalizer() File "C:\Program Files\Python36\lib\weakref.py", line 548, in call return info.func(*info.args, **(info.kwargs or {})) File "C:\Program Files\Python36\lib\site-packages\usb_objfinalizer.py", line 104, in _do_finalize_object_ref obj._do_finalize_object() File "C:\Program Files\Python36\lib\site-packages\usb_objfinalizer.py", line 71, in _do_finalize_object self._finalize_object() File "C:\Program Files\Python36\lib\site-packages\usb\backend\libusb1.py", line 604, in _finalize_object _lib.libusb_unref_device(self.devid) OSError: exception: access violation writing 0x0000000000000024 USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow USB Error: [Errno 132] Overflow

Can you help me to sort this somehow, I already ended up spending a lot of my project hours not able to sort this.

arrrobase commented 5 years ago

This may have to do with the fact that's it's trying to connect twice to the device. When you invoke py.pattern_mode(), it tries to connect to the device for you. py.pattern_mode() also sets the input_mode to 'pattern'. If you're going to instantiate your own connection to the device instead of using the context manager or provided functions, stick to using the dlpinstance you created instead of using the provided convenience functions (like power_upand pattern_mode). I don't have any experience with using a pattern stored in the flash however.

nikhil4595 commented 5 years ago

Thanks @awctomlinson I'll try it out. Do you,by chance, happen to have any example or demo code that you used,which worked for you ?

arrrobase commented 5 years ago

Hi @nikhil4595, I use pycrafter in another of my projects here. I'm only using pattern_mode though since that was the part relevant to our experiments.

nikhil4595 commented 5 years ago

Thanks ,I'll try it out.