Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 39 of 39

Thread: New MCP23S17 Library

  1. #26
    wtf, sucess! i changes CS to 36, then back to 37 and it started working! if i cut power i need change to 36 then back to 37 again to make it work.

  2. #27
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,095
    why adc? are you sharing the bus? is it releasing the MISO line? I don't know your connections, everything you attached, or code, just bits of pieces and alot of guesswork...

    sounds like you have code conflict and/or hardware issues

  3. #28
    im not using the adc when testing the mcp, im using your example in first post as i said, and no added code. The adc and a couple of other things are attached to the same spi bus. but i dont try to communicate to them. (as i said, im using your example)

    I only mentioned the adc becuse it could use the spi bus without problems, and therefore the problem should be elsewhere.

  4. #29
    well im happy that it works, but a bit anoyed i have the change CS pins on every new power up and thanks for trying to help!

  5. #30
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,095
    try to use a different pin, like the original SPI bus pin 10, you shouldn't need to change pins for it to work

  6. #31
    yeah, but pin 10 is used for another spi device, so a bit of a problem there, could this be some kind of software bugg? i tried using the adc (that uses cs 10) and the mcp at the same time and had no problems(accept that i need to change CS pins as mentioned in my other post), so i guess my spi bus is working fine.

    Have you tried using the mcp with another CS pin like 37 for example?

  7. #32
    btw, by changing pin i mean changing pin no. in the constructor, not changing any physical connection as im using a pcb i made

  8. #33
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,095
    sounds like a timing issue, try adding a delay in setup somewhere before begin() is called

  9. #34
    that did it, thanks!

  10. #35
    Junior Member
    Join Date
    Nov 2019
    Posts
    7
    Quote Originally Posted by tonton81 View Post
    well it should work with demo above, i have 8 chips running on a T4.0 on SPI with pin 10 as CS

    if it's wired and configured properly, mcp.info() will detect it
    In order to use this on multiple chips, does the chip select need to go to the same pin on the teensy? i.e. pin 10 in your example? I am thinking that is the way it is supposed to work now that I am looking at it. I currently have each chip's CS going to it's own pin. I also have them addressed sequentially. Is there a way to get this library to talk to all of them? I will make the adjustment to the pcb on the next run to have them all on the same CS pin. Thank you in advance for your help.

  11. #36
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,095
    yes all the CS to one pin, make sure you have all 8 chips with different addresses

  12. #37
    Junior Member
    Join Date
    Nov 2019
    Posts
    7
    Thank you. Connected all of the CS to one pin, and now everything is working well.

  13. #38
    Junior Member
    Join Date
    Nov 2019
    Posts
    7
    Does anyone know of a library like this for the I2C version of these expanders? I can no longer get the SPI version, but can get the i2c version. I would like to just redesign the board and change a bit of the code, instead of a large rewrite. crossing my fingers. Thank you in advance for your help

  14. #39
    Senior Member
    Join Date
    Oct 2016
    Posts
    1,223
    Quote Originally Posted by Claritydnb View Post
    Does anyone know of a library like this for the I2C version of these expanders? I can no longer get the SPI version, but can get the i2c version. I would like to just redesign the board and change a bit of the code, instead of a large rewrite. crossing my fingers. Thank you in advance for your help
    Googled "arduino MCP23017". First item shown below. May not have same API as this SPI library.

    https://www.arduino.cc/reference/en/libraries/mcp23017/

Posting Permissions

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