The Functions Available From The imp005’s Pins
The imp005 offers an extensive array of GPIO pins. However, only two buses (one SPI and one I²C) and five PWM-capable pins (see below) are accessible through the GPIO pin array. The imp005 also has no ADC or DAC support.
The module adopts the same pin nomenclature as the imp003. Squirrel code written to address pins and/or peripherals on other imps will require modification for use with the imp005.
Pin |
i2cJK |
spiBCAD |
PWM (see below) |
State Change Callback |
---|---|---|---|---|
A | SCLK | Yes | ||
B | COPI | Yes | ||
C | CIPO | Yes | ||
D | CS | Yes | ||
E | Yes | Yes | ||
F | Yes | Yes | ||
G | Yes | Yes | ||
H | Yes | |||
J | SCL | Yes | ||
K | SDA | Yes | ||
L | Yes | |||
M | Yes | |||
N | Yes | |||
P | Yes | |||
Q | Yes | |||
R | Yes | |||
S | Yes | Yes | ||
T | Yes | |||
U | Yes | Yes | ||
V | Yes | Yes | ||
W | Yes | |||
Y | Yes | |||
XA | Yes | |||
XB | Yes | |||
XC | Yes | |||
XD | Yes | |||
XE | Yes |
Call imp.info(). This returns a meta object with the property type, which is is a string containing the imp module name:
if (imp.info().type == "imp005") {
// Device is an imp005/Murata Type1GC...
}
Unlike earlier imp types, the imp005 does not tristate (float) all of its IO pins at start-up. Instead, the pins are set the following defaults:
imp005 Pins | Default State |
---|---|
C, H, L, M, N, P, R, T, W, Y, XA | Tristate (floating) |
B, D, K | Driven high (logic 1) |
A, E, F, G, J, Q, S, U, V | Driven low (logic 0) |
XB, XC, XD, XE | Pulled-up (not driven up) |
Unlike earlier imps, the imp005 makes one further SPI bus, one further I²C bus and all of its UARTs accessible only through dedicated pins. These dedicated pins are not usable as for GPIO. The buses themselves are accessed as named object members of the hardware object. These dedicated buses are:
imp API object | Bus | Notes |
---|---|---|
hardware.i2c0 | I²C | |
hardware.spi0 | SPI | |
hardware.uart0 | UART | RX, TX, RTS and CTS |
hardware.uart1 | UART | RX and TX only — see UART, below |
hardware.uart2 | UART | RX and TX only — see UART, below |
CIPO is the signal previously referred to as MISO. COPI is the signal previously referred to as MOSI.
The imp005 supports PWM.
USB is accessible on the imp005 via the imp API object hardware.usb.
For USB host to work correctly in imp005, both pinR and pinW need to be dedicated to USB and cannot be used for GPIO. Typically, a USB implementation will use a USB load switch which both controls power and detects overcurrent fault conditions. This load switch should have the power control pin connected to pinR (high = power enabled to USB bus) and the fault indication pin connected to pinW (low = fault present).
Whether or not a USB load switch is implemented, pinR should always be driven high using hardware.pinR.configure(DIGITAL_OUT, 1)
and pinW should be pulled up, either by a physical pull-up resistor or by configuring the pin with pull-up enabled using hardware.pinW.configure(DIGITAL_IN_PULLUP)
.
None of the imp005 UART buses currently reports noise or line idle errors.
For both hardware.uart1 and hardware.uart2, UART RX may be driven low during chip power on and reset. If you are connecting RX to a driven UART you must put a 1KΩ or higher series resistor to prevent damage to both chips.
The minimum FIFO size is 80 entries.
All imp005 GPIO pins, when assigned as digital inputs, can be configured with functions that will be called when the pin’s state changes.