background image

Hardware Overview

As we mentioned in the Introduction, the Qwiic GPIO features the TCA9534 I/O Expander to communicate with up
to eight digital input/output pins via I C. In this section we'll examine the characteristics of the TCA9534 as well as
the features of the Qwiic GPIO breakout.

TCA9534 I/O Expander IC

The TCA9534 from Texas Instruments provides an I C to parallel digital input output interface. We'll cover the
basics here but for a thorough overview of the TCA9534 refer to the datasheet. The IC has an operating input
voltage range of 

1.65V

 to 

5.5V

 but we recommend powering it with 

3.3V

 via either the Qwiic connector or through

any of the 

3.3V

 and Ground pins to maintain compatibility with other Qwiic devices.

The TCA9534 supports both standard (100kHz) and fast mode (400kHz) I C frequencies. The IC also features an
active-low interrupt pin that is activated when any pins configured as an input have a different state from the Input
Port register state. This means you can connect this INT pin to an interrupt-capable pin on your microcontroller to
passively monitor devices connected to the TCA9534. For more information on this functionality, refer to section
8.3.2 in the TCA9534 datasheet and Example 4 - Interrupt in the Qwiic GPIO Arduino Library.

Three hardware pins (A0, A1 and A2) are dedicated I C address select pins. We've added three jumpers to the
Qwiic GPIO to allow users to have up to 8 boards on the same bus. The Solder Jumpers section below goes into
more detail on how those pins and jumpers are used on the Qwiic GPIO.

Latch Terminals

The Qwiic GPIO breaks out all eight of the TCA9534's I/O pins, the interrupt pin, as well as several power rail pins
(

3.3V

 and Ground) to four 4-pin latch terminals so wiring peripherals to the board is extremely easy. All you need

to do is insert a stripped wire into your preferred terminal opening and press down firmly on the latch handle to
secure the wire into place.

What is an interrupt? In a nutshell, there is a method by
which a processor can execute its normal program
while continuously monitoring for some kind of event,
or interrupt. There are two types of interrupts: hardware
and software interrupts. For the purposes of this
tutorial, we will focus on hardware interrupts.

Handling PCB jumper pads and traces is an essential
skill. Learn how to cut a PCB trace, add a solder
jumper between pads to reroute connections, and
repair a trace with the green wire method if a trace is
damaged.

2

2

2

2

Содержание Qwiic GPIO

Страница 1: ...ander IC from Texas Instruments to add up to 8 digital inputs and outputs controlled via an I C interface The TCA9534U features three address select pins that can be set to configure eight unique addr...

Страница 2: ...e In this guide we ll go over everything you need to know about the Qwiic GPIO so you can add those extra I O pins to your circuit with ease Required Materials In order to follow along with this tutor...

Страница 3: ...re a few options for each of those cable types SparkFun Qwiic Shield for Thing Plus DEV 16790 SparkFun Qwiic Shield for Arduino DEV 14352 SparkFun Qwiic Adapter DEV 14495 SparkFun Qwiic Shield for Ard...

Страница 4: ...ok Up Wire Assortment Stranded 22 AWG PRT 11375 Qwiic Cable 200mm PRT 14428 Polarity An introduction to polarity in electronic components Discover what polarity is which parts have it and how to ident...

Страница 5: ...tion on this functionality refer to section 8 3 2 in the TCA9534 datasheet and Example 4 Interrupt in the Qwiic GPIO Arduino Library Three hardware pins A0 A1 and A2 are dedicated I C address select p...

Страница 6: ...CL GND and 3 3V on the Qwiic GPIO are broken out to a pair of Qwiic connectors as well as standard 0 1 spaced PTH pins for those who would prefer to solder to them The default I C address for the Qwii...

Страница 7: ...state is closed This holds the Interrupt pin HIGH so it can be driven LOW when an interrupt event is monitored by the TCA9534 Open the jumper if you have another pullup on the Interrupt pin Address Ju...

Страница 8: ...IO you will need to solder to them For a temporary connection for prototyping these IC Hooks are a great option to make that connection For users not familiar with through hole soldering take a look a...

Страница 9: ...ns so you may want to refer to those for help with writing your own code using them Device Setup Settings bool begin TwoWire wirePort uint8_t address Initialize the TCA9534 on the I C bus If you have...

Страница 10: ...ion we will go over those examples and highlight a few things to take note of when setting up your Qwiic GPIO in code Note If you are using the SparkFun Qwiic Micro SAMD21 Development Board as shown i...

Страница 11: ...PIO_OUT GPIO_OUT GPI O_OUT GPIO_OUT Along with the pin mode we also need to define the initial state of each GPIO bool gpioConfig NUM_GPIO HIGH LOW HIGH LOW HIGH LOW HIGH LOW With the GPIO port config...

Страница 12: ...d GPIO Port Example 2B demonstrates how to read the entire GPIO port on the TCA9534 The code sets up all eight GPIO pins just like Example 1B using a boolean but this time all pins are set as inputs W...

Страница 13: ...l print LOW break Serial println n delay 100 Example 3A Inversion Example 3A shows how to invert the signal polarity of an input on the Qwiic GPIO Polarity inversion only works on pins configured as a...

Страница 14: ...g processor interrupts on a microcontroller this tutorial will help you get started Example 4 demonstrates how to use the interrupt pin on the TCA9534 when any input pin registers a change The interru...

Страница 15: ...nstead with a different development board or single board computer like the Raspberry Pi read on to the next two sections where we ll detail how to use the Qwiic GPIO Python Package Qwiic GPIO Python...

Страница 16: ...allation To install make sure the setuptools package is installed on the system Direct installation at the command line use python for Python 2 python3 setup py install To build a package for use with...

Страница 17: ...or copy the code into a file then open save the example file if needed and execute the code in your preffered Python IDE Qwiic GPIO Example 1 This example sets up all eight I O pins as outputs and to...

Страница 18: ...IO mode_7 myGPIO GPIO_OUT myGPIO setMode while True myGPIO out_status_0 myGPIO GPIO_HI myGPIO out_status_1 myGPIO GPIO_HI myGPIO out_status_2 myGPIO GPIO_HI myGPIO out_status_3 myGPIO GPIO_HI myGPIO o...

Страница 19: ...shows how to read each I O pin when they are configured as inputs It first sets up all pins using the setMode function as we did in Example 1 The code then monitors and prints out the status of each...

Страница 20: ...e_5 myGPIO GPIO_IN myGPIO mode_6 myGPIO GPIO_IN myGPIO mode_7 myGPIO GPIO_IN myGPIO setMode while True myGPIO getGPIO This function updates each in_status_x variable print GPIO 0 end print myGPIO in_s...

Страница 21: ...f of them using the setInversion self function As we covered in the Arduino Examples section each I O pin set as an input defaults to an active HIGH input so inverting it switches it to an active LOW...

Страница 22: ...myGPIO GPIO_IN myGPIO setMode myGPIO inversion_0 myGPIO INVERT myGPIO inversion_1 myGPIO NO_INVERT myGPIO inversion_2 myGPIO INVERT myGPIO inversion_3 myGPIO NO_INVERT myGPIO inversion_4 myGPIO INVERT...

Страница 23: ...at wraps up this Hookup Guide For more information about the Qwiic GPIO take a look at the following links Schematic PDF Eagle Files ZIP Dimensional Drawing PNG TCA9534 Datasheet PDF Hardware GitHub R...

Отзывы: