\" $NetBSD: umcpmioctl.8,v 1.4 2025/03/22 06:54:13 rillig Exp $
\"
\" Copyright (c) 2024 Brad Spencer <
[email protected]>
\"
\" Permission to use, copy, modify, and distribute this software for any
\" purpose with or without fee is hereby granted, provided that the above
\" copyright notice and this permission notice appear in all copies.
\"
\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
\"
Dd November 24, 2024
Dt UMCPMIOCTL 8
Os
Sh NAME
Nm umcpmioctl
Nd interact with a MCP2221 / MCP2221A multi-io chip
Sh SYNOPSIS
Nm umcpmioctl
Op Fl dh
Ar device
Cm status
Nm umcpmioctl
Op Fl dh
Ar device
Cm get sram
Nm umcpmioctl
Op Fl dh
Ar device
Cm get gp
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash cs
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash gp
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash usbman
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash usbprod
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash usbsn
Nm umcpmioctl
Op Fl dh
Ar device
Cm get flash chipsn
Nm umcpmioctl
Op Fl dh
Ar device
Cm put flash gp
Ar GPn PIN_FUNCTION ...
Sh DESCRIPTION
The
Nm
utility interacts with a MCP2221 / MCP2221A and can be used to pull
the status of the chip, get the SRAM values, get the values from the
on-board FLASH and can be used to set some of the FLASH values
associated with the GPIO pins.
The values from flash are copied into the SRAM when the chip
enumerates or powers up.
Pp
For the
Cm put flash
command,
Ar GPn
is one of
Cm GP0 ,
Cm GP1 ,
Cm GP2
or
Cm GP3 ,
and
Ar PIN_FUNCTION
is one of
Cm GPIO_PIN_INPUT ,
Cm GPIO_PIN_OUTPUT ,
Cm GPIO_PIN_ALT0 ,
Cm GPIO_PIN_ALT1 ,
Cm GPIO_PIN_ALT2 ,
Cm GPIO_PIN_ALT3 ,
Cm DEFAULT_OUTPUT_ZERO
or
Cm DEFAULT_OUTPUT_ONE .
Pp
For the
Cm put flash
command, the
Ar GPn
and
Ar PIN_FUNCTION
pairs may be repeated.
Sh EXAMPLES
Dl "umcpmioctl /dev/umcpmio0ctl status"
Pp
Query the chip for its status.
Pp
Dl "umcpmioctl /dev/umcpmio0ctl get sram"
Pp
Return the values from the SRAM on the chip.
Pp
Dl "umcpmioctl /dev/umcpmio0ctl get flash cs"
Pp
Return the values for the chip settings from the FLASH.
Pp
Dl "umcpmioctl /dev/umcpmio0ctl put flash gp GP0 GPIO_PIN_INPUT"
Pp
This will set the GP0 pin to be an input pin on start up of the chip.
Pp
Dl "umcpmioctl /dev/umcpmio0ctl put flash gp GP2 GPIO_PIN_OUTPUT GP0 GPIO_PIN_ALT0"
Pp
This will set the GP2 pin to be an output pin and GP0 pin to have the
ALT0 function upon chip start up.
Sh SEE ALSO
Xr gpio 4 ,
Xr umcpmio 4
Sh HISTORY
The
Nm
utility first appeared in
Nx 11.0 .
Sh AUTHORS
An -nosplit
The
Nm
utility was written by
An Brad Spencer Aq Mt
[email protected] .
Sh BUGS
Only the gpio settings can be changed in FLASH.
Pp
The output is not very pleasant to use and one will probably need to
have the data sheet for the MCP2221 / MCP2221A on hand to make sense of
it.