Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Help with Teensy hanging SOMETIMES with a MCP23017 connected

  1. #1

    Help with Teensy hanging SOMETIMES with a MCP23017 connected

    Hi Guys

    I would really appreciate some advice/guidance/help with a problem.

    I am using a teensy 3.6 with 2 encoders without switches, 4 encoders with switches and 14 momentary push buttons plus a i2c MCP23017 with 6 encoders without switches and 1 encoder with a switch all interfacing with x-plane, and generally working very nicely. Also, Iím reading x-planeís status and turning on the pin 13 LED.

    Itís all set up on a couple of breadboards, I had a lot of wiring issues with the MCP23017 but it seems OK now after swapping out the breadboard and IC, except for the problem.

    My problem is, SOMETIMES the Teensy hangs when rotating an encoder a couple of full turns OR after 10 or 20 minutes have passed.

    Both issues are very intermittent and can be resolved by unplugging and replugging the usb cable.

    Not sure how to go about debugging this, I donít find it easy to debug Arduino sketches and short of debugging it donít really know what I can test to try and track the issue down. I donít have access to or the ability to use fancy test equipment.

    I can post a fritzing and code if its any help.

    Malcolm

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,540
    Do you have 2 pull-up resistors somewhere on the I2C bus? The raw MCP23017 does not have pull-up resistors.

    You might want to checkout https://github.com/TeensyUser/doc/wiki/I2C for more information.

  3. #3
    Quote Originally Posted by MichaelMeissner View Post
    Do you have 2 pull-up resistors somewhere on the I2C bus? The raw MCP23017 does not have pull-up resistors.

    You might want to checkout https://github.com/TeensyUser/doc/wiki/I2C for more information.
    Yes Iíve got 4.7k resistors to +3.1 volts on both lines. Did have 2.2k resistors but the bus seemed more unstable with these.

    Iíve read the wiki but it didnít help me much. Itís a very intermittent error, for example had a 1.5 hr flight this afternoon with one hang (which happened when I was turning an encoder) cleared by a hard reset.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •