Pin Mapping and limitations of the MCP2515 library in Simulink

1 次查看(过去 30 天)
Dear Mathworks.
Since revision 2019b, MCP2515 is supported as a library in Simulink. My questions are related to this library.
For me coming from an Arduino background I'm used to designing my own shields. Sometimes I'm therefore using other pins for interrupt and chip select, based on certain design criterias for that particular shield. From what I can read in the documentation about these libraries, the pin mappings are restricted to a few certain pins. To me that seems as a quite severe limitation that doesn't really give any proper advantage. Some of my shields also use more than one CAN channel, i.e. multiple MCP2515:s. It seems as the libraries are restricted to use only one channel. I'm sure that you are aware of this but it is not at all uncommon with nodes that are present on several CAN buses, for example powertrain and chassi-can.
My questions are therefore:
Question 1: Is there any possiblity of unlocking the pin mapping so that the Interrupt and Chip Select pins can be used more freely?
Question 2: Would it be possible to add support for more than one Can-bus using the MCP2515 library?

回答(1 个)

Arun Kumar
Arun Kumar 2020-10-5
Hi Anders,
I've answered your questions below.
Possibility of Unlocking pins:
There's only one restriction for SPI chip select pin. You can select any pin that is exposed on Arduino header to act as SPI Chip select. The only restriction being - it should not be SPI pin(SPI Clock, SPI MISO, or SPI MOSI).
Currently, we don't support pins that are not exposed on Arduino header. If you intend to use those pins, please let us know. We can consider adding support for them in future releases.
Interrupt Pin: This pin needs to be a pin that has interrupt capability. On AVR targets, these pins are limited but for Arm targets, there are plenty of options to choose from.
Support for more than one CAN channel:
Since the communication with the CAN chip is happening over SPI, there are some limitations when it comes to communicating with multiple CAN chip over SPI. We'll consider this for future releases though.
Thanks a lot for your feedback.
-Arun
  3 个评论
Arun Kumar
Arun Kumar 2022-4-6
Hi Christof,
INT pin of the MCP2515 is the interrupt pin.
Connect this pin to a pin of your Arduino hardware that supports external interrupt and update that pin in the configuration settings "Interrupt Pin" parameter.
Refer this table to know which pins support external interrupt.
Hope this helps!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Run on Target Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by