Teensy 3.5 vs Teensy 3.6 digital pins

Status
Not open for further replies.

quadrupel

Well-known member
I've been playing around with the MCP23017 io expander and I've come across a conundrum. The data sheet says that the maximum i2c clock speed is 1.7 MHz. Using the i2c_t3 library and the Teensy 3.6, at 1.7 MHz I have a stable connection. But, with the Teensy 3.5, I can only obtain a stable connection up to 1.0 MHz. 1.2 MHz is iffy, and after that, no joy in Whoville.

This leads me to ask, is the fact that the digital pins on the Teensy 3.5 are 5 volt tolerant and the Teensy 3.6 are not, the root cause of my conundrum, or is there something I'm overlooking? For your enjoyment, I've posted a trivial program that I've used to test the two Teensy boards.

Any advice would be appreciated.

Code:
#include <i2c_t3.h>
#include "MCP23017_T3.h"

MCP23017 io {&Wire};

void setup()
{
  Wire.begin();

  // 1.7 MHz is maximum i2c clock rate for the MCP23017 using the Teensy 3.6
  // 1.0 MHz is maximum i2c clock rate forthe  MCP23017 using the Teensy 3.5
  Wire.setClock(1000000);

  io.begin();

  io.pinMode(0, INPUT);
  io.pullUp(0, HIGH); 

  io.pinMode(8, OUTPUT);
  io.digitalWrite(8, LOW );
}

void loop()
{
  bool button = ( io.digitalRead(0) == LOW );
  io.digitalWrite(8, button );
}
 
Status
Not open for further replies.
Back
Top