# Arduino MCP2515 / CAN interface

**URL:** <https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033>\
**Category:** Peripherals\
**Tags:** evb-amb82, rtl8735b\
**Created:** [June 13, 2024, 1:01pm UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033 "2024-06-13T13:01:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![angus1357](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@angus1357](https://forum.amebaiot.com/u/angus1357)\
**Post date:** [June 13, 2024, 1:01pm UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/1 "2024-06-13T13:01:45Z")

</div>

Is there a compatible library for the MCP2515 chipset? I’ve tried a handful and they all say they are missing SPI\_MODE0.

---

<div class="post-metadata">

**Author:** ![Pammy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/pammy/32/936_2.png) [@Pammy](https://forum.amebaiot.com/u/Pammy)\
**Post date:** [June 14, 2024, 1:27am UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/2 "2024-06-14T01:27:55Z")

</div>

@angus1357

May I know which board and SDK are you using?

---

<div class="post-metadata">

**Author:** ![angus1357](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@angus1357](https://forum.amebaiot.com/u/angus1357)\
**Post date:** [June 17, 2024, 11:14am UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/3 "2024-06-17T11:14:08Z")

</div>

Sorry for the delay, I am using the Adafruit MCP2515 Library and the SDK given in the AMB82 mini setup ([https://github.com/ambiot/ambpro2\_arduino/raw/main/Arduino\_package/package\_realtek\_amebapro2\_index.json](https://github.com/ambiot/ambpro2_arduino/raw/main/Arduino_package/package_realtek_amebapro2_index.json))

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [June 18, 2024, 3:58am UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/4 "2024-06-18T03:58:16Z")

</div>

Hi @angus1357,

Right now, we do not have this SPI library. This library will have to be ported to our SDK. Can you screenshot your errors and post them here? You can try to port this library.

Thank you.

---

<div class="post-metadata">

**Author:** ![angus1357](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@angus1357](https://forum.amebaiot.com/u/angus1357)\
**Post date:** [October 4, 2024, 2:21pm UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/5 "2024-10-04T14:21:37Z")

</div>

Its been a handful of months but I am coming back to this. I realize I’ll have to write the SPI commands myself but can you tell me what the Processor clock speed is in regards to the 2 different SPI channels? CAN communication needs that input to create the right configurations to function. Also a quick explanation of how the CS lines are treated in the SPI.h would be awesome too! I know I can just use SPI.transfer but do I control the CS manually or is it automated somewhere? The examples you provide are not low level and are very tuned to specific examples so they dont really help in this instance.

---

<div class="post-metadata">

**Author:** ![angus1357](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@angus1357](https://forum.amebaiot.com/u/angus1357)\
**Post date:** [October 7, 2024, 12:01pm UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/6 "2024-10-07T12:01:14Z")

</div>

The error on runtime is this:

07:51:00.812 →   
07:51:00.812 → == RAM Start ==  
07:51:00.812 → Build @ 14:48:33, Jun 6 2024  
07:51:00.812 → [SSI Err]e[31mspi\_format(): Invalid Pin seleciton a5.  
07:51:00.812 → e[0m [MISC Err]Pin 5[5] is conflicted  
07:51:00.812 → [MISC Err]It’s configured as SPI Master/I2S now.  
07:51:00.812 → [MISC Err]It’s using by peripheral 50000004  
07:51:00.846 → [SSI Err]PIN a5 cannot be registered.  
07:51:00.846 → [SSI Err]e[31mspi\_format(): SPI 0 init fails.  
07:51:00.846 → e[0m [SSI Err]Please initialize SPI format first!  
07:51:00.846 →   
07:51:00.846 → $8735b\> [MISC Err]Pin 4[4] is conflicted  
07:51:00.846 → [MISC Err]It’s configured as SPI Master/I2S now.  
07:51:00.846 → [MISC Err]It’s using by peripheral 50000004  
07:51:00.846 → [SSI Err]PIN 84 cannot be registered.  
07:51:00.846 → [SSI Err]e[31mspi\_format(): SPI 0 init fails.  
07:51:00.878 → e[0m [SSI Err]Please initialize SPI format first!  
07:51:00.878 → [SSI Err]Please initialize SPI format first!

Im not sure if thats coming from the AMB side or the MCP driver side!

---

<div class="post-metadata">

**Author:** ![M-ichae-l](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/m-ichae-l/32/33_2.png) [@M-ichae-l](https://forum.amebaiot.com/u/M-ichae-l)\
**Post date:** [October 14, 2024, 2:55am UTC](https://forum.amebaiot.com/t/arduino-mcp2515-can-interface/3033/7 "2024-10-14T02:55:42Z")

</div>

![](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/2X/4/48ee262a34207410e30c2776371f35d822d60c73.png)
