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

Thread: MCP23017 with teensy 4.1 at 1MHz?

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    10

    MCP23017 with teensy 4.1 at 1MHz?

    Hi,
    I try to set a project on teensy 4.1 with MCP4728 and MCP23017, both at 1MHz.
    The MCP4728 works nicely at 1MHz, but the MCP23017 does not.
    I have tried all the three I2C buses, none of them work.
    Any idea, how can I make it works?
    Best, Dezso

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    975
    The MCP23017 datasheet says it supports 100kHz, 400kHz and 1.7MHz I2C, and has a section on timing requirements for each mode - that
    probably explains why 1MHz is problematic.

  3. #3
    Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    50
    Also, what power rail are you using? The datasheets don’t show characteristics for 1MHz, but at 1.7MHz they both need 4.5V or more. Try at 400kHz.

    Cheers

    Jonathan

  4. #4
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    Thanks for suggestions!
    I though, anything can work under 1.7MHz (I am not professional in electronics...)
    I use it at 3.3V. It is possible to us it at higher voltage than the voltage of the teensy 4.1?

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,280
    I'd double-check if you really need more than 400kHz instead. Humans tend to overestimate some things..

  6. #6
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    I need the 1MHs for the MCP4728 to shorten the loops. I need a large set of DAC, and on the same I2C I would use the MCP23017.

  7. #7
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,445
    Quote Originally Posted by dizso View Post
    I need the 1MHs for the MCP4728 to shorten the loops. I need a large set of DAC, and on the same I2C I would use the MCP23017.
    You might also consider the SPI version: MCP23S17 which should work with 10MHz SPI clock.

  8. #8
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    I was thinking about the SPI version, but I need large set of MCP23017 too, so no chance to have enough pin for CS.
    And the panels of the MCP23017 are ready...
    I was thinking to make software I2C pins, but none of the libraries worked for me (SoftWire, SlowSoftWire, SoftI2CMaster, SlowSoftI2C...)

  9. #9
    Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    50
    Quote Originally Posted by dizso View Post
    Thanks for suggestions!
    I though, anything can work under 1.7MHz (I am not professional in electronics...)
    I use it at 3.3V. It is possible to us it at higher voltage than the voltage of the teensy 4.1?
    At least test at 400kHz to see if that's the issue... don't think you can use it even at 4.5V, as the minimum Vih is 0.8xVdd so 3.6V. You might find a sweet spot where Vdd is high enough to get 1MHz, and low enough to allow 3.3V (nominal) signals from the Teensy. Or an intermediate bus speed (say 700kHz) which works with 3.3V.

    Cheers

    Jonathan

  10. #10
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    400kHz works nicely with both chip at 3.3V!
    So, I will try something under 1MHz. I let you know about the result!

  11. #11
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    277
    By the looks of it the mcp23s17 can have adressing which means that your only need one CS for all the expanders, the other pins are then connected in parallel.
    http://www.ermicro.com/blog/?p=1050

  12. #12
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    Quote Originally Posted by h4yn0nnym0u5e View Post
    At least test at 400kHz to see if that's the issue... don't think you can use it even at 4.5V, as the minimum Vih is 0.8xVdd so 3.6V. You might find a sweet spot where Vdd is high enough to get 1MHz, and low enough to allow 3.3V (nominal) signals from the Teensy. Or an intermediate bus speed (say 700kHz) which works with 3.3V.

    Cheers

    Jonathan
    I have tried 700kHz, but the Wire setclock() did not change the rate. It could set 1000000 and 400000 and 100000 as i have found.

  13. #13
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    Quote Originally Posted by manicksan View Post
    By the looks of it the mcp23s17 can have adressing which means that your only need one CS for all the expanders, the other pins are then connected in parallel.
    http://www.ermicro.com/blog/?p=1050
    Thanks, i did not find it before unfortunatelly. Right now my panels are ready, so i shoud improve the i2c somehow.
    And the speed of the 23017 is just a side effect. The DAC must be faster.

  14. #14
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    Something strange experience: if the pullup is 2.2k ond the sda and 10k on the sca! The 1MHz is working!

  15. #15
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,697
    i use a RaspPi 8xmcp23s17 breakout board on Teensy4, I only needed to run 6 wires between teensy and the breakoutboard to get 128gpio support at 10mhz

  16. #16
    Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    50
    Quote Originally Posted by dizso View Post
    Something strange experience: if the pullup is 2.2k ond the sda and 10k on the sca! The 1MHz is working!
    What were the pullups before? You didn't post a schematic Fast speeds generally need lower value pullups (up to a point).

  17. #17
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    Sorry, i have just my phone on internet so no schematic is avaleable.
    I used 10k on both and than 2.2k on both. The sda 2.2k with sca 10k works.
    I need more tests with more chips on the same bus.

  18. #18
    Junior Member
    Join Date
    Apr 2021
    Posts
    10
    So, it looks like this:
    Click image for larger version. 

Name:	Capture 2021_04_12.jpg 
Views:	17 
Size:	76.8 KB 
ID:	24420

  19. #19
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    933
    I can also highly recommend the SPI version, MCP23s17. especially as the set up of all eight chips on one CS line works very fast on polling loop, so no need to worry about dealing with interrupts and all the potential pitfalls of that approach. over a 100 in out on just one SPI, and dealt with via polling, worth another look if not too late for you.

Posting Permissions

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