Forum Rule: Always post complete source code & details to reproduce any issue!
-
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.
-
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
-
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.
-
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!
-
try to use a different pin, like the original SPI bus pin 10, you shouldn't need to change pins for it to work
-
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?
-
btw, by changing pin i mean changing pin no. in the constructor, not changing any physical connection as im using a pcb i made
-
sounds like a timing issue, try adding a delay in setup somewhere before begin() is called
-
that did it, thanks!
-

Originally Posted by
tonton81
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.
-
yes all the CS to one pin, make sure you have all 8 chips with different addresses
-
Thank you. Connected all of the CS to one pin, and now everything is working well.
-
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
-

Originally Posted by
Claritydnb
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
-
Forum Rules