Pin Mapping and limitations of the MCP2515 library in Simulink

조회 수: 1 (최근 30일)
Anders Johansson
Anders Johansson 2020년 9월 20일
댓글: Arun Kumar 2022년 4월 6일
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
Christof Hadamek
Christof Hadamek 2022년 4월 6일
What Interrupt GPIO Pin is the Model Konfiguration in Simulink using?
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