I'm trying to add an MCP23017 chip to my bread board which is using a Teensy 3.6.
My whole sketch is attached.
The problem I am having is that in Setup, I can't get through the whole MCP setup.
Below is the setup block and my debug code prints 1 in the serial window and then stops. I never see 2, 3, etc.
Thank you for any help.
My whole sketch is attached.
The problem I am having is that in Setup, I can't get through the whole MCP setup.
Below is the setup block and my debug code prints 1 in the serial window and then stops. I never see 2, 3, etc.
Thank you for any help.
Code:
#include <Adafruit_MCP23017.h>
#include <i2c_t3.h>
#include <SD.h>
#include "SPI.h"
const byte mcp1_address = 0x20; // I2C Address of 1st MCP23017 Chip: 12 Softkeys
const byte GPIOA = 0x12; // Register Address of Port A
const byte GPIOB = 0x13; // Register Address of Port B
byte c = 0;
int buttonPressDelay = 200;
int mx = 0;
int my = 0;
void setup()
{
Serial.begin(115200);
while (!Serial)
{
}
Serial.println("Setup begin");
int debug2 = 1;
//Send settings to MCP device
Wire.begin(I2C_MASTER, 0x00, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_RATE_400);
if (debug2 == 1) Serial.print("1"); // <------------------- stops here
Wire.beginTransmission(mcp1_address);
Wire.write(0x00); // IODIRA registers - Bank A
Wire.write(0xFF); // set all of bank A pins to input type
Wire.endTransmission();
if (debug2 == 1) Serial.print("2");
Wire.beginTransmission(mcp1_address);
Wire.write(0x01); // IODIRB registers - Bank B
Wire.write(0xFF); // set all of bank B pins to input type
Wire.endTransmission();
if (debug2 == 1) Serial.print("3");
Wire.beginTransmission(mcp1_address);
Wire.write(0x0C); //pull up resistors on bank A pins
Wire.write(0xFF); // set all of bank A pins to input type
Wire.endTransmission();
if (debug2 == 1) Serial.println("4");
Wire.beginTransmission(mcp1_address);
Wire.write(0x0D); // IODIRB register - Bank B
Wire.write(0xFF); // set all of bank B pins to input type
Wire.endTransmission();
Serial.println("Setup end");
}