フィルターのクリア

canChannel on Longan CANBed Arduino unable to find MCP2515

7 ビュー (過去 30 日間)
CDB
CDB 2022 年 5 月 11 日
回答済み: Manikanta Aditya 2024 年 1 月 12 日
I have a Longan CANBed V1 (https://docs.longan-labs.cc/1030008/), which is an Arduino Leonardo and MCP2515 on the same board. It works fine with the Arduino IDE using the Seeed Studio CAN bus library, with the CS pin set to 17.
I am trying to set it up in MATLAB using the following code:
a = arduino('com5', 'leonardo', 'Libraries', 'CAN');
tx = canChannel(a, 'MCP2515', 'A4', 'D2');
However, this gives the following error: "Unable to find MCP2515. Check if the chip select pin and the interrupt pins are correctly connected."
I have tried all combinations of chip select and interrupt pins, but none seem to work. Any advice?

回答 (1 件)

Manikanta Aditya
Manikanta Aditya 2024 年 1 月 12 日
Hi,
From the error message, it is seen that the MATLAB suggests that it's unable to find the MCP2515 chip. This could be due to incorrect pin assignments.
According to the (Longon documentation https://www.longan-labs.cc/1030008.html ) the board uses the MCP2515 as its CAN controller and the MCP2551 as its CAN receiver. However, the specific pin assignments for the MCP2515 aren’t mentioned in the documentation.
In your MATLAB code, you’re setting the Chip Select (CS) pin to ‘A4’ and the Interrupt pin to ‘D2’. However, you mentioned that the CS pin is set to 17 when using the Arduino IDE with the Seeed Studio CAN bus library. This discrepancy might be causing the issue.
If this doesn’t solve the issue, I recommend checking the Longan Labs documentation or their support for specific pin assignments for the MCP2515 on the CANBed V1.

カテゴリ

Help Center および File ExchangeSetup and Configuration についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by