Git Product home page Git Product logo

cp210x-cfg's Introduction

cp210x-cfg

CLI utility for programming CP210x USB<->UART bridges

Intended as a scriptable alternative to the official Silicon Labs CP21xx Customization Utility.

Tested with CP2102 and CP2105 chips.

Supported fields that can be programmed:

  • Vendor ID
  • Product ID
  • Product Name string
  • Serial string
  • Buffer flush bitmap
  • SCI/ECI gpio/modem mode

CAUTION

Programming a CP210x config field is a write-once operation. It's perfectly possible to write bad values. The consequences are yours, and yours alone.

Suffice to say that I've got a couple of modules which have a VID/PID of 0000:0000. Don't do that. If you happen to screw up the VID/PID anyway, in Linux you can sort-of work around it by registering the new VID/PID combo with the cp210x driver like so:

echo 0000 0000 | sudo tee /sys/bus/usb-serial/drivers/cp210x/new_id

Consider yourself forewarned, and forearmed.

Examples

####Showing the built-in help message (may differ from below)

$ ./cp210x-cfg -h
Syntax:
cp210x-cfg [-h ] |
           [-m vid:pid] [-d bus:dev]
           [ -l | [-V vid] [-P pid] [-F flush] [-M mode] [-N name] [-S serial]]

  -h            This help
  -m vid:pid    Find and use first device with vid:pid
  -d bus:dev    Find and use device at bus:dev
  -l            List all CP210x devices connected
  -V vid        Program the given Vendor ID
  -P pid        Program the given Product ID
  -F flush      Program the given buffer flush bitmap (CP2105 only)
  -M mode       Program the given SCI/ECI mode (CP2105 only)
  -N name       Program the given product name string
  -S serial     Program the given serial string

Unless the -d option is used, the first found CP210x device is used.
If no programming options are used, the current values are printed.

Switching a CP2105 into modem mode

$ sudo ./cp210x-cfg -d 4.113 -M 0
ID 10c4:ea70 @ bus 004, dev 113: CP2105 Dual USB to UART Bridge Controller
Model: CP2105
Vendor ID: 10c4
Product ID: ea70
Name: CP2105 Dual USB to UART Bridge Controller
Serial: 007079CC
Flush buffers: 33
SCI/ECI mode: 0000

cp210x-cfg's People

Contributors

jmattsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cp210x-cfg's Issues

error: failed to read cfg item 3703: Input/Output Error

I sometimes get errors when reading CP2102 devices. I get the same errors when trying to write the NAME field. I haven't tried any other changes.

$ sudo cp210x-cfg -m 10c4:ea60
ID 10c4:ea60 @ bus 001, dev 014: CP2102N USB to UART Bridge Controller
Model: CP210Q
Vendor ID: 10c4
Product ID: ea60
error: failed to read cfg item 3703: Input/Output Error
Serial: 55f11b71d8cdbac69d77ac99e08c527b
$ sudo cp210x-cfg -m 10c4:ea60
ID 10c4:ea60 @ bus 001, dev 014: CP2102N USB to UART Bridge Controller
Model: CP210Q
Vendor ID: 10c4
Product ID: ea60
Name: CP2102N USB to UART Bridge Controller
Serial: 55f11b71d8cdbac69d77ac99e08c527b
$ sudo cp210x-cfg -m 10c4:ea60 -N FOO10R200
ID 10c4:ea60 @ bus 001, dev 014: CP2102N USB to UART Bridge Controller
error: failed to set cfg item 3703: Pipe error
Model: CP210Q
Vendor ID: 10c4
Product ID: ea60
error: failed to read cfg item 3703: Input/Output Error
Serial: 55f11b71d8cdbac69d77ac99e08c527b

"error: failed to read cfg item 3704: Other error" with empty serial number

I have a cp2102 USB-serial dongle with no serial number set, and cp210x-cfg reports an error:

# ./cp210x-cfg
ID 10c4:ea60 @ bus 000, dev 003: CP2102 USB to UART Bridge Controller
Model: CP2102
Vendor ID: 10c4
Product ID: ea60
Name: CP2102 USB to UART Bridge Controller
error: failed to read cfg item 3704: Other error

I can set a serial number:

# ./cp210x-cfg -S $(pwgen -s 10)
ID 10c4:ea60 @ bus 000, dev 003: CP2102 USB to UART Bridge Controller
Model: CP2102
Vendor ID: 10c4
Product ID: ea60
Name: CP2102 USB to UART Bridge Controller
Serial: 8OoOE8NmD5

And I can tell cp210x-cfg to set the serial number back to an empty string, which returns the error again:

# ./cp210x-cfg -S ""
ID 10c4:ea60 @ bus 000, dev 003: CP2102 USB to UART Bridge Controller
Model: CP2102
Vendor ID: 10c4
Product ID: ea60
Name: CP2102 USB to UART Bridge Controller
error: failed to read cfg item 3704: Other error

But the Python cp210x-program does report the empty serial number, without error:

# python2 ./cp210x-program
[usb device]
product_string = CP2102 USB to UART Bridge Controller
serial_number = 
...

So it looks like everything functions correctly, except for emitting the error message.

error: failed to set cfg item 3704: Pipe error

Hi, thanks for the great utility, I use it to keep straight which devboard has which firmware by setting it's Serials. But with some boards I recently developed I'm met with this. Any help or suggestion as to the cause would be appreciated.

sparklemotion 13:26 [s] $ sudo ./cp210x-cfg -S "test"
ID 10c4:ea60 @ bus 007, dev 007: CP2102N USB to UART Bridge Controller
error: failed to set cfg item 3704: Pipe error
Model: CP210Q
Vendor ID: 10c4
Product ID: ea60
Name: CP2102N USB to UART Bridge Controller
Serial: c4fada6439c5e711b8928568f41b81de

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.