CAN communication in NVIDIA Jetson Nano
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi,
I am trying to interface a IMU sensor that has CAN communication with NVIDIA Jetson Nano and visualize the data in simulink and use the data in my model.
But as the NVIDIA Jetson Nano doesn't have inbuilt CAN interface, I would like some inputs on how this can be done using the MATLAB/Simulink support packages for NVIDIA Jetson.
Can some one give me inputs on how I can integrate CAN communication in a Jetson Nano and use the data over CAN within my Simulink Models.
Thank you
採用された回答
Ramakrishna Mandalapu
2023 年 11 月 7 日
Hi Vasanth,
Unfortunately, on Jetson Nano there are no built-in CAN controllers. You can refer to this post on the NVIDIA blog. In the post they confirm that there are no CAN controllers on Jetson Nano. In addition, they provide a CAN solution through SPI interface, you can follow that approach if you want CAN only IMU integration. IMU sensors can be interfaced through I2C as well. The current sensors we support through Simulink uses I2C. I suggest if you are not concerned about the interface then you can take advantage of these sensor blocks in the support package "MATLAB Coder support package for NVIDIA Jetson and NVIDIA DRIVE Platforms".
Thanks,
Ramakrishna
8 件のコメント
Vasanth Krishnan
2023 年 11 月 7 日
Hi Ramakrishna,
Thank you for the reply.
I want to interface via CAN only as the sensor supports only that and also I have other control units that send their data via CAN which I would like to bring into Simulink as inputs to my models developed and run it on NVIDIA Jetson Nano.
I went through the blog that you shared, and my doubt here is once I use a MCP2515 CAN shield and use SPI to interface with NVIDIA Jetson Nano and follow the steps given in the blog, what are the next steps to visualize that CAN data within Simulink and use it as inputs to my model. Can you walk me through the steps ? Are there any blocks/functions that I can use to achieve the same?
Also instead of using MCP2515 CAN shield, can I use CAN-USB converters and use the Serial write/read block within Simulink to read and write CAN messages. If yes, my doubt over there is, how do I selectively extract specific CAN ID data with the Serial write/read blocks from the CAN message pool that is coming in ? Is there a way around that ?
And during my research, I came across setting up Virtual CAN, Will this be of any use to solve the issue ?, Can you give me some insight on what basically is the use case of Virtual CAN?
Regards,
Vasanth Krishnan
Ramakrishna Mandalapu
2023 年 11 月 9 日
Hi vasanth,
Please find my responses below.
what are the next steps to visualize that CAN data within Simulink and use it as inputs to my model. Can you walk me through the steps ? Are there any blocks/functions that I can use to achieve the same?
If this approach creates the availability of CAN interfaces on the Jetson then you can directly use those interfaces. usually, when you connect CAN controllers then you will see can0, can1, etc. interfaces. In this case, you can use CAN Receiver and CAN Transmitter blocks of the support package.
Also instead of using MCP2515 CAN shield, can I use CAN-USB converters and use the Serial write/read block within Simulink to read and write CAN messages. If yes, my doubt over there is, how do I selectively extract specific CAN ID data with the Serial write/read blocks from the CAN message pool that is coming in ? Is there a way around that ?
Yes, you can use, the USB CAN device most of the times creates the interfaces can0, can1, etc. You can use the exisitng CAN blocks in the support package to access devices connected to these interfaces.
I came across setting up Virtual CAN, Will this be of any use to solve the issue ?, Can you give me some insight on what basically is the use case of Virtual CAN?
Virtual CAN is asoftware emulated CAN interface, it is not a physical interface but helps to validate the CAN workflows without connecting the actual CAN hardware. This helps in prototyping/modelling our CAN based workflows before incorporating into the actual/bigger workflows.
Thanks,
ramakrishna
Vasanth Krishnan
2023 年 11 月 10 日
Hi Ramakrishna,
Thank you for the response, it was really helpful.
I have created the can0 and can1 now with two SPI CAN shield interfaces and checked the same with ifconfig.
But while executing a very simple communication check like the following, by connecting the CAN H and CAN L of the shields together,

I am getting the following error,

I am not able to figure out how to debug and rectify this. What is the reason for this error ? The steps I followed are similar to the second half of " https://uk.mathworks.com/help/coder/nvidia/ug/jetson-can-bus-traffic-sign-detection.html ".
Can you give me some insights on the same ?
Regards,
Vasanth Krishnan
Ramakrishna Mandalapu
2023 年 11 月 10 日
Hi Vasanth,
In this case, some of the external mode signals need dynamic memory, so we should configure the Simulink accordinlgy. Can you disable the 'Static memory allocation' setting in the Code Generation->Interface->External mode configuration, if enabled.
Thanks,
Ramakrishna
Vasanth Krishnan
2023 年 11 月 11 日
Hi Ramakrishna,
I am not able to find that option in the settings. Can you share some screenshots of the same ?
The following are the options available in my settings,
Can you please point out to the particular option ?
Thank you,
Vasanth Krishnan
Ramakrishna Mandalapu
2023 年 11 月 20 日
Hi Vasanth,
Do you have "Embedded coder" installed? if not then these setting will not be available.
Thanks,
Ramakrishna
Vasanth Krishnan
2023 年 11 月 20 日
Hi Ramakrishna,
I have rectified the error and its now working good. I got the CAN working in the Jetson Nano both via USB-CAN as well as SPI and I am able to visualize the data within Simulink.
Thank you for your inputs,
Vasanth
Vinzenz Brian Gerhard
2024 年 6 月 26 日
Hello Vasanth,
could you share your setup with the SPI communication? I am thinking of using the jetson nano with some CAN devices and want to find out how to do it. My main concerns are:
- What CAN shield are you referring to? When I search for "MCP2515 CAN shield" as you mentioned, I only see shields for Arduino.
- To which pins on the jetson nano should the shield be connected?
- How did you configure the CAN receive and CAN transmit blocks in your model?
Thank you for your help.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with GPU Coder についてさらに検索
参考
2023 年 11 月 6 日
2024 年 6 月 26 日
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
