Clear Filters
Clear Filters

Processing J1939 BAM messages with VNT

15 views (last 30 days)
I'm trying to use the Vehicle network tool box to capture and process a transport protocol multi packet message.
The message is sent over BAM or broad cast, and i've created blocks to capture when RTS message goes out, but is there a method of captureing the disperate values across a set of packets and present the final thing in an array, or is it dump to the workspace and let some other script figure it out.

Accepted Answer

Shivam Lahoti
Shivam Lahoti on 20 Oct 2023
Hi Charles,
From what I can understand, you want to process a multi-packet transport protocol over the J1939 communication channel and want to capture the disparate values across a set of packets.
The vehicle Network toolbox provides several blocks that could be used to receive packets from different communication protocols, Since the transport protocol is over the J1939 communication channel VNT has a J1939 Receive block. The J1939 Receive block receives a J1939 message from the configured CAN device. Please look at the following documentation to understand the J1939 receive block.
Along with this have a look at the following documentation’s function segment to understand the different functions available to process the transport protocol.
For example, to receive all the available parameter groups from the bus by specifying a count of Inf.:
db = canDatabase('MyDatabase.dbc')
chan = j1939Channel(db,'Vector','CANCaseXL 1',1)
start(chan)
pgrp = receive(chan,Inf)
I hope this helps.
Regards,
Shivam Lahoti.
  1 Comment
Charles Coulton
Charles Coulton on 20 Oct 2023
Thank you! The programatic example is great. I have since found out that DBC files if they define a message as multipacket, will receive the message even if it comes in as a single packet. It does mean that you have to watch for the TP packets and use that to process what you got from multipacket parser it is much more flexiable than it seems on the outset. But that is likely more a function of the limitations of the DBC spec than of MATLAB or simulink.

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!