I have a CAN board with a mcp2515 and i'm using the Seeed-Studio Arduino library. Can somebody show me the proper syntax for using the 2nd SPI port. The example that comes with the library works fine with the default SPI port 1. I just need help using SPI port 2
Which Arduino are you using? Most don't have a second SPI port.
arduino mega 2560 which has 5 SPI ports.
I actually looked into this a little while ago. None of the XCK pins (PE2, PD5, PH2, PJ2) are broken out so you can't use the additional USARTs in MSPIM without some delicate soldering. I think Software SPI is probably your best bet.
is there any particular reason why you wish to use a second SPI port?
you can attach a number of devices to an SPI port so long a each has a seperate select line to choose the device you wish to talk to.
If you have problems stacking shields which use the same select line you can cut the pins and use jumpers to switch the select line to different IO line (and update the code accordingly)
I have a wiznet5500 ethernet shield using the first SPI port. The documentation of the Seeed mcp2515 library allows you to select the SPI port, but i am not skilled enough to figure it out. In the past i used a different library that was hard coded and was able to change the library to use the 2nd SPI port. Just thought it would be easier to use this updated library