Is there a way to use Arduino Hardware with Vehicle Network Toolbox?

1 次查看(过去 30 天)
I'm trying to implement a low cost In-Vehicle Data Recorder (IVDR) using an Arduino Due and MCP2515 CAN-BUS Shield. I know that Simulink Hardware Support Package for Arduino Hardware has CAN-transmit and CAN-receive blocks available, but the problem is that my vehicle's OBD2 PID's are vehicle-specific and are not provided by the manufacturer (Nissan), so I must first implement a "CAN-sniffer" in order to monitor the CAN messages being transmitted to reverse engineer the PID's. Vehicle Network Toolbox provides a Vehicle CAN Bus Monitor App that does just this, as well as several other capabilities through MATLAB and Simulink that allow OBD2 and CAN communication, but the toolbox only supports hardware from specific vendors such as National Instruments, Vector and Kvaser. Is there a way to access this capabilities using Arduino Hardware? or are there other ways to implement said CAN monitoring app using Arduino support packages for MATLAB and Simulink?

回答(1 个)

Arun Kumar
Arun Kumar 2019-10-24
Hi Daniel,
You can implement CAN sniffer by using the existing CAN Receive block in Simulink Support Package for Arduino Hardware. To do so, configure the CAN Receive block receive data in "CAN Msg" mode and use a "Bus Selector" to extract all the IDs and data from the bus. After extracting, you can either view the messages in Simulink or export the data to MATLAB using "To Workspace" block to further analyze the data. Make sure to to disable all filters by selecting "Allow All Messages" in "CAN properties" section of config set.
Other than sniffing, can you share the other capabilities of VNT which you wanted to access using Arduino.
Also, MATLAB support for MCP2515 using Arduino is under consideration, and might be added in future releases.
Hope this helps.
Cheers!
  1 个评论
Daniel Campos
Daniel Campos 2019-10-27
Hi Arun,
Thank you for getting back to me on this issue. I've tried implementing the can sniffer as you suggested but still had no luck. I'll run you through the model and my hardware implementation settings to see if I'm missing something:
Hardware board: Arduino Due
Serial Port Properties: set baud rate of all ports to 115200
CAN properties: Oscillator Frequency 8MHz, Allow All Messages Checked
CAN Receive block set to CAN Msg with default sample time of 0.1.
In the bus selector block I checked "Output as virtual bus", and selected the ID signal from the "Signals in the bus" section on the left.
The output of the bus selector is connected to a "To Workspace" block and a Display. Neither the display nor the "To Workspace" block show any data. After code generation I get a warning message saying that To Workspace block can't save data in external mode.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sensors 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by