MCP23016 I/O expander


Closed Thread
Results 1 to 40 of 43

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Hmm, ok. I've gone through the datasheet more times than I can remember, but I never saw any mention of PU resistors on the clock/data lines. Is there any mention in it? Or are we 'expected' to know better?

    The only reason I thought of them is from reading the PBP Pro manual.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you put a scope on your I2C Bus, you would have realised the waveform didn't meet the specification of Table 2-5 in the Datasheet. Some devices do not require PU Resistors, PICs do... the clue could also have been found in the PBP manual I2C commands where an example schematic is given connecting to an external EEPROM. 4K7 is a good value when connecting one or two slave devices with a relatively short track between them. You need to drop this value for more devices or greater track capacitance. Refer to Raph's pointer to the I2C Bus Spec.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Yup, like I said, that's exactly where I found the answer.

    Things worked great, until I got cocky.

    Yeah, I also noticed that more devices screws up stuff. At least I have Ralph's link to help me out to figure the correct resistance value.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Hmm, still getting unreliable results.

    Sorry, but the oscilloscope readings are still just a tad over my head. I was hoping to be able to diagnose this problem with more conventional techniques (if I can).

    I placed my multimeter on 2000pF, the only pF setting I have, plugged 2 wires in the built-in holes (for capacitors) and then tested from SDA pin on PIC up to SDA pin on MCP.

    I get 30pF, but now I realize that the wires I'm using could very well affect the reading. The probes only test A, V, Ohms and Hz, so I can't use those.

    I had used 1.5K pull-up resistors and that had helped a lot. But it still has a way to go for reliable performance. I'll do as mentionned above and lower the resistor slowly and see if things improve.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    One note about this circuit:

    - PIC 16F877 mcu
    - triple MCT6 opto-couplers
    - 24AA512 eeprom
    - dual MCP23016 (one used as input, one as output)

    I use the MCT6 to switch between the SDA lines on the I2C devices. I used both sides of the MCT6 per device to permit bidirectional transfer.

    The SCL line is shared amongst all the I2C devices.

    I separated the input and output MCP23016 because I plan to have 8 of each later. I am only using one now to test the system.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    A picture is better and easier to spot the mistakes.

    Robert
    Attached Images Attached Images  
    Last edited by Demon; - 23rd October 2005 at 04:14.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Ok, I went down to 1K and things seemed worse. So I went the other way and tried 2.2K with perfect results.

    The part that sucks about this is that the breadboard and PCB and NOT going to have identical capacitance. I may not know what I'm talking about, but I know that much.

    It sure is nice to see the circuit act as it should though. At least now I have an idea of where to look if things act up when I print this circuit. Some trial&error with resistors at worse, if I'm lucky I'll learn how to use an oscilloscope properly by then.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Demon
    I separated the input and output MCP23016 because I plan to have 8 of each later. I am only using one now to test the system.

    Robert
    Since the MCP (like most other I2C Devices) has 3 address bits you can have up to 8 devices of the same type sharing one bus.

    For more than 8 (up to 16) devices of the same type share SCL for all of them and have separate SDA for each set of 8.
    So to communicate with 16 Devices of the same type you need three Ports on the PIC.

    I don't use the MCP, I prefer the PCF8574.
    There is an "A" version available that has a control-byte different from the "non A" version, so you can have up to 16 (8x"A" & 8x"non A") devices sharing one pair of SDA cnd SCL lines.
    Last edited by Demon; - 4th October 2016 at 19:10.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. I/O extender
    By mychangl in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 20th November 2008, 15:56
  2. MCP23016 I2C serial I/O expander chip
    By GeoJoe in forum Serial
    Replies: 7
    Last Post: - 31st October 2007, 16:39
  3. MCP23016 I/O expander with PBP?
    By Jon Chandler in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd August 2005, 10:32
  4. I2C I/O Expander PCF8574 hanging?
    By NavMicroSystems in forum Serial
    Replies: 12
    Last Post: - 4th August 2005, 03:26
  5. managing the I/O ports of the 16F84A
    By skyler_91600 in forum mel PIC BASIC
    Replies: 7
    Last Post: - 28th April 2005, 04:52

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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