Interfacing a MCP2515 CAN controller to a Xenon

Hello, I am new to particle and just started exploring the xenon hardware. I would like to connect a MCP2515 or 2517 to the SPI bus on a xenon board. I have imported the arduino-CAN library and was looking to find where or how I allocate the SPI bus up for the MCP2515. I see the how to set the SPI hardware up for the xenon, but how do I associate it to the arduino-CAN library so using the API to transmit and receive CAN messages uses the SPI hardware? Any help on how that is done is appreciated.

Thank you,

Not sure what you mean by that. The HW SPI bus pins on the Xenon are marked MI, MO & SCK and the chip/slave selecte pin is free to choose.
A secondary SPI interface exists on the Xenons too - that can be found here

That would typically be the job of the library - it should provide you with high level functions to do exactly that.

When you are referencing a library it’s always good to also provide a link to save others the need to search.


Apologies, for being unclear. The name of the library is arduino-CAN that I imported. This is the data from the library properties file:

( name=arduino-CAN version=0.0.1
sentence=CAN bus for Particle using the MCP2515
paragraph=This library is intended for the mesh boards which have no onboard CAN controller

I understand the pinning of the Xenon ports and setting them to be used as SPI. I guess what I am asking is how does a library that is imported associate its’ high level interface to the low level SPI pins? Is there usually a place in an imported library to set/define what SPI port pins are being used?

Best Regards,

Via this command

Since that library explicitly uses SPI the pins that are tied to that interface are used.
Only the CS pin could be chosen via this