The CP210x driver v6.7.5 is now the "legacy" driver and can be used on Windows 7, 8 and 10. The differences between the two versions of the drivers can be explained in the following way -
2. Functional differences, i.e., why have v10.1.1?
The driver version v6.7.5 is for "Desktop" Editions of Windows 7 and later, i.e., Windows 7, 8, 8.1 and 10. Please note that these drivers are valid only for "Desktop" editions, i.e., PCs and servers. Windows v10.1.1 is a universal Windows driver. "Universal" was introduced by Microsoft in Windows 10. "Universal" means desktop plus embedded plus mobile, etc. editions of Windows that support Universal, i.e., Windows 10. For more information about Universal drivers, please refer to this article by Microsoft - https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/getting-started-with-universal-drivers. This knowledge base article on our community forum has more information about universal drivers in general and driver v10.1.1 in particular - https://www.silabs.com/community/interface/knowledge-base.entry.html/2017/12/27/vcp_driver_-_windows-Ulur.
3. Serial Enumeration
Serial enumeration is enabled in v6.7.5 while v10.1.1 does not have serial enumeration enabled.
4. Legacy versus Current
Technically, the driver version v6.7.5 is almost a "legacy" driver. Windows and in turn Silicon Labs is planning to continue using only v10.1.1 and make edits (if necessary) to that version of the driver.
Please note that if you are running a desktop PC with Windows 10, you can use either v6.7.5 or v10.1.1 drivers on your system.
ctypes is a foreign function library for Python. It provides C compatible data types and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.
Loading DLL
dll = cdll.LoadLibrary("CP210xManufacturing.dll")
Load a shared library into the process and return it. This method always returns a new instance of the library.
3. Call functions inside the DLL
Some functions contain pointer parameters, like this one:
Currently a new configuration tool called Xpress Configuration is available for CP210x devices configuration. This tool has already been integrated into Simplicity Studio. This article is originally written for user using the legacy CP21xx Customization Utility tool for CP210x device configuration.
By default, all of the GPIO pins (GPIO.0/1/2) are configured as a GPIO input. To use the alternate function of CP2104 on GPIO.0/1/2, corresponding pins should be configured as "Automatic Control by Firmware" using the legacy CP21xx Customization Utility. To do this, click Port Configuration and then select "Latch Control". Click the button in the "Value" column to open the "Latch Control Settings" window and check GPIO.0/1/2 as needed.
Note that the Port Configuration of the pins is one-time programmable for each CP2104 device. Check and ensure all parameters are set properly before clicking the "Program Device" button.
After programming, these pins will be automatically controlled by the device to output a high or low level depending on data transmission.
Interface Knowledge Base
Difference between CP210x driver v10.1.1 and v6.7.5
At the outset, CP210x driver v10.1.1 is a Windows Universal driver. More information regarding this driver can be found in this KB Article - https://www.silabs.com/community/interface/knowledge-base.entry.html/2017/12/27/vcp_driver_-_windows-Ulur.
The CP210x driver v6.7.5 is now the "legacy" driver and can be used on Windows 7, 8 and 10. The differences between the two versions of the drivers can be explained in the following way -
1. Differences in the Driver Software
This has been captured by the release notes documentation which can be obtained from here - https://www.silabs.com/documents/public/release-notes/CP210x_Universal_Windows_Driver_ReleaseNotes.txt
2. Functional differences, i.e., why have v10.1.1?
The driver version v6.7.5 is for "Desktop" Editions of Windows 7 and later, i.e., Windows 7, 8, 8.1 and 10. Please note that these drivers are valid only for "Desktop" editions, i.e., PCs and servers. Windows v10.1.1 is a universal Windows driver. "Universal" was introduced by Microsoft in Windows 10. "Universal" means desktop plus embedded plus mobile, etc. editions of Windows that support Universal, i.e., Windows 10. For more information about Universal drivers, please refer to this article by Microsoft - https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/getting-started-with-universal-drivers. This knowledge base article on our community forum has more information about universal drivers in general and driver v10.1.1 in particular - https://www.silabs.com/community/interface/knowledge-base.entry.html/2017/12/27/vcp_driver_-_windows-Ulur.
3. Serial Enumeration
Serial enumeration is enabled in v6.7.5 while v10.1.1 does not have serial enumeration enabled.
4. Legacy versus Current
Technically, the driver version v6.7.5 is almost a "legacy" driver. Windows and in turn Silicon Labs is planning to continue using only v10.1.1 and make edits (if necessary) to that version of the driver.
Please note that if you are running a desktop PC with Windows 10, you can use either v6.7.5 or v10.1.1 drivers on your system.
How do I setup CP2108 port config using python?
Question
How do I setup CP2108 port config using python?
Answer
1. Get CP210x manufacturing DLL from AN721
The AN721SW package contains a DLL file for accessing CP210x configuration. Here is the path of the Windows DLL:
AN721SW\Windows\CP210x_InterfaceLibrary\ManufacturingDLL\x86_64\CP210xManufacturing.dll
2. Load DLL file
Prepare a Python file named cp210x.py,
ctypes is a foreign function library for Python. It provides C compatible data types and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.
Load a shared library into the process and return it. This method always returns a new instance of the library.
3. Call functions inside the DLL
Some functions contain pointer parameters, like this one:
Python ctypes exports the byref() function, which is used to pass parameters by reference.
Here is the example:
For a CP2108 device, it outputs "Found 4 devices"
4. Get CP2108 port config
Two functions access CP2108 port config:
The parameter QUAD_PORT_CONFIG is a structure defined in CP210xManufaturingDLL.h.
In Python, structures and unions must derive from the structure and union base classes defined in the ctypes module.
Here are the definitions in Python:
Then, we can get the port config values and set one GPIO to be a clock output. Here is the example code:
On the board, we can see the LED DS3 is on. We can see clock signal by measuring the waveform on an oscilloscope.
5. Reference
Here is the Python official website for ctypes
https://docs.python.org/3.4/library/ctypes.html#structure-union-alignment-and-byte-order
虚拟串口CP210x系列功能有何差异?
问题:
虚拟串口CP210x系列功能有何差异?
答案:
虚拟串口产品的特点是:安装驱动程序后插入设备操作系统中可以看到一个虚拟的COM端口(虚拟意味着没有RS232接口的串口硬件,但是从软件角度可以与旧的RS232端口进行同样的通信)。常见的串口软件,比如“串口助手”,Windows自带的“超级终端”等软件可以直接打开
虚拟串口(VCP: Virtual COM Port)产品,包括的产品有:CP2101、CP2102、CP2103、CP2104、CP2105、CP2108、CP2109、CP2102N。这些产品使用共同的VCP驱动,在虚拟串口数量、通信速度、芯片引脚数量上有些差异。有如下几种类别:
1. USB转单串口:CP2101、CP2102、CP2103、CP2104、CP2109
一个芯片可以实现一个虚拟串口。其中:
CP2101是第一代产品,最大吞吐量欠佳、芯片体积大,已不推荐新产品使用。
CP2102是Flash产品,参数可以修改多次,芯片体积大。
CP2109是CP2102的OTP版本,成本较低。CP2102/CP2109 的IO不可以做通用的GPIO.
CP2103和CP2104类似,CP2103是基于flash的,CP2104是OTP版本,在体积和速度上有差异:
CP2103 波特率最大1Mbps,封装5x5mm QFN
CP2104 波特率最大2Mbps,封装4x4mm QFN
CP2102N是最新的基于flash的,成本较低。新的客户建议优先选用该系列。
2. USB转双串口:CP2105
一个芯片可以实现两个虚拟串口。芯片上的存储器是OTP,参数仅可以修改一次。
3. USB转四串口:CP2108
一个芯片可以实现四个虚拟串口。芯片上的存储器是Flash,参数可以多次修改。
How to enable GPIO pin alternate functions of CP2104 using CP21xx Customization Utility
Currently a new configuration tool called Xpress Configuration is available for CP210x devices configuration. This tool has already been integrated into Simplicity Studio. This article is originally written for user using the legacy CP21xx Customization Utility tool for CP210x device configuration.
By default, all of the GPIO pins (GPIO.0/1/2) are configured as a GPIO input. To use the alternate function of CP2104 on GPIO.0/1/2, corresponding pins should be configured as "Automatic Control by Firmware" using the legacy CP21xx Customization Utility. To do this, click Port Configuration and then select "Latch Control". Click the button in the "Value" column to open the "Latch Control Settings" window and check GPIO.0/1/2 as needed.
Note that the Port Configuration of the pins is one-time programmable for each CP2104 device. Check and ensure all parameters are set properly before clicking the "Program Device" button.
After programming, these pins will be automatically controlled by the device to output a high or low level depending on data transmission.