Borrar filtros
Borrar filtros

How can we read CAN message through Kvaser's CAN Device by Packet Input block in Simulink Desktop Real-Time?

31 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Jan Houska
Jan Houska el 11 de Jul. de 2024 a las 19:50
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 comentarios
Jan Houska
Jan Houska el 17 de Jul. de 2024 a las 5:29
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
友基
友基 el 21 de Jul. de 2024 a las 18:39
Dear Jan,
Thank you for your kind support. Now I can read the IMU mesurements over CAN by the Packet Input block.
I have tried the following steps:
  1. Power on the IMU before starting MATLAB/Simulink.
  2. Execute the Kvaser Device Guide and check the Canlib Channel number for the KVASER LEAF LIGHT V2. This number is "CAN channel" in Packet input block.
  3. Input decimal number in the CAN message ID in the block.
Regards, T.T.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Vehicle Network Toolbox en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by