canChannel on Longan CANBed Arduino unable to find MCP2515
조회 수: 4 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Run on Target Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!