Skip to main content

pymcp2221

This is a python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters (manufacturer's page).

First and foremost, there are python packages for the same chip available here and here. If you use them and are satisfied, you probably won't find improvements in my package. If you're missing some features however, my code is meant to expose every chip feature described in the datasheet in a systematic manner, for python 3.2+.

Implemented features

  • Status/Set Parameters (0x10) - ok
  • Read Flash Data (0xB0) - ok
  • Write Flash Data (0xB1) - ok
  • Send Flash Access Password (0xB2) - ok
  • I2C Write Data (0x90) - ok
  • I2C Write Data Repeated Start (0x92) - ok
  • I2C Write Data No Stop (0x94) - ok
  • I2C Read Data (0x91/0x40) - ok
  • I2C Read Data Repeated Start (0x93/0x40) - ok
  • Set GPIO Output Values (0x50) - ok
  • Get GPIO Values (0x51) - ok
  • Set SRAM Settings (0x60) - ok, except GPIO directions/values through SRAM (duplicate with 0x50)
  • Get SRAM Settings (0x61) - ok, except GPIO directions/values through SRAM (duplicate with 0x51)
  • Reset Chip (0x70) - ok

Every feature marked ok is implemented, but some of them, like I2C, haven't been tested in real conditions.

Requirements

Setup

From command line, use:

python setup.py install

or for Linux/OSX:

sudo python setup.py install

On Linux, to access your devices without root privileges, you need to set specific udev rules, as explained in hidapi documentation.

Examples

See examples folder.

Tests

The tests folder contains unit tests for most of the aspects of this package. To run them, use:

python -m unittest

API

You can find docs in the docs folder (generated from python docstrings). Alternatively, you can rely on python docstrings

  1. either from the command line, use pydoc:
pydoc mcp2221
  1. or from within python:
import mcp2221; help(mcp2221)

Metadata

Release files for pymcp2221 1.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymcp2221 1.0.12
File Size Uploaded Provenance Actions
pymcp2221-1.0.12.tar.gz 23.3 kB Without provenance Details for pymcp2221-1.0.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymcp2221 1.0.12
File Interpreter ABI Platform Actions
pymcp2221-1.0.12-py3-none-any.whl Python 3 none any Details for pymcp2221-1.0.12-py3-none-any.whl

Total release size: 49.2 kB

Release files / pymcp2221-1.0.12.tar.gz

Download URL pymcp2221-1.0.12.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d3366be233849fb08c2f843f0d3dc5d4b17847d1503b05716b65dad73a016fc0
BLAKE2b-256 checksum
How to use checksums
e6f6a7b90dd6c2de36e2f1581e8154c663dfe601fb5c1da81ba7219494bdb35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / pymcp2221-1.0.12-py3-none-any.whl

Download URL pymcp2221-1.0.12-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e709b8cbc59d5ef2b4471a2a5102e52114f4bf12b4e5e8764292a7dd265177a
BLAKE2b-256 checksum
How to use checksums
a0273e020412c92cf9162533044ad01dda955acd1925b519645045fe1680ea28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for pymcp2221 1.0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page