drbild / cp2130 Goto Github PK
View Code? Open in Web Editor NEWPython library for the Silicon Labs CP2130 USB to SPI Bridge
License: Apache License 2.0
Python library for the Silicon Labs CP2130 USB to SPI Bridge
License: Apache License 2.0
Great library!
For me to get it to work I had to change the order of imports in __init (https://github.com/drbild/cp2130/blob/master/cp2130/__init__.py#32) as the usb import did not raise an exception, but it then failed with LIBUSB_ERROR_NOT_SUPPORTED [-12] error. However import pyusb first worked well
I also had to remove the call to is_kernel_driver_active in https://github.com/drbild/cp2130/blob/master/cp2130/usb/pyusb.py as it was marked as NotImplemented.
I have pyusb 1.2.1 installed. (import usb, usn._version.version)
The code run fail right at the 3rd line "chip = cp2130.find()"
Below is all the log. I tried to disable "libusb1" to force it use "pyusb" but also failed to detect device.
I check the connection with hardware is OK. I also could see the SPI device in the device manager. I used the verified Application for my HW to check the SPI communication with HW, and everything is OK.
BTW, I'm using Windows 8 and python 3.6.2.
Traceback (most recent call last):
File "31-cp2130.py", line 6, in <module>
chip = cp2130.find()
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\cp2130\__init__.py", line 32, in find
from cp2130.usb import libusb1 as usb
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\cp2130\usb\libusb1\__init__.py", line 17, in <module>
from cp2130.usb.libusb1.core import *
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\cp2130\usb\libusb1\core.py", line 18, in <module>
from cp2130.usb.libusb1.hotplug import HotplugListener, HotpluggedDevice
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\cp2130\usb\libusb1\hotplug.py", line 19, in <module>
import usb1
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\usb1\__init__.py", line 61, in <module>
from . import libusb1
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\usb1\libusb1.py", line 199, in <module>
libusb = _loadLibrary()
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\usb1\libusb1.py", line 173, in _loadLibrary
return dll_loader('libusb-1.0' + suffix, **loader_kw)
File "C:\Users\user_name\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__i
nit__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
Hi, I am using cp2130 now. A questions, the document say to configure the pin's mode (gpio, usb, spi) need a site-software named "XPRESS CONFIGURATOR", I did not know that means I must use "XPRESS CONFIGURATOR"? Can I configure it by codeing with the api? (with out XPRESS CONFIGURATOR)
Thanks for writing and sharing such a useful python package. I just found a bug in the spi.py file.
There is an typo in the method "write" in the SPIChannel class. Lines 92 and 93 are
op = lambda: self.chip.write(data)
return self._do(op, data)
And, line 93 should be
return self._do(op, cs_hold)
Cheers,
SaeWoo
The straightforward fix would simply be to use to_bytes
instead, although this would break backwards compatibility with python 2. However, since python 2 hasn't been supported in four years, I don't think that should be a problem.
Seems this was noticed a while back and a PR was opened here. #5.
I'm quite happy to make this change myself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.