How can we read CAN message through Kvaser's CAN Device by Packet Input block in Simulink Desktop Real-Time?
10 views (last 30 days)
Show older comments
I'm trying to read IMU output, 8byte, though a Kvaser Leaf Light HS V2. I've installed Kvaser's drivers and i can read data by software supplied with the IMU.
Now, I'd like to read the output data in MATLAB. I've installed Simulink Desktop Real-Time and use the Packet Input block.
Although we can choose a Kvaser's CAN Device in the Packet block's parameter, "Install new board", do we need the Vehicle Network Toolbox?
I noticed that the similar problem is posted in the link bellow, but the posted date is 2015. Is this situation still the same today?
https://jp.mathworks.com/matlabcentral/answers/194604-is-the-kvaser-leaf-light-hs-supported-by-both-vehicle-network-toolbox-and-real-time-windows-target
0 Comments
Accepted Answer
Jan Houska
on 11 Jul 2024
Hello,
to read raw CAN data, Vehicle Network Toolbox should not be needed. You will need to specify the output data types (decode the raw CAN data) manually by entering the data types in the block dialog. Please see the sldrtex_canio shipping example.
If you prefer to use the CAN_MESSAGE or CAN_MESSAGE_BUS data types and the Vehicle Network Toolbox block library to decode the received data, then of course a license of Vehicle Network Toolbox is needed. Please see the sldrtex_canmessage shipping example to see how this can be done.
Good Luck, Jan
3 Comments
Jan Houska
on 17 Jul 2024
Hello,
the CAN IDs are entered as decimal, not as hexadecimal. Please use the "hex2dec" function to convert, for example, 31A would convert to 794. I cannot tell if your data is Big Endian or Little Endian, but you probably have this one correct. I think everything else is correct as well.
Good Luck, Jan
More Answers (0)
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!