Azzera filtri
Azzera filtri

Unable to Received Multiframe CAN Data In MATLAB

4 visualizzazioni (ultimi 30 giorni)
Hello All, I am unable to receive Multiframe Data in Matlab through J1939 Protocol, Actually when I am Transmit the Multiframe it is not responding the CTS, Could you please help me to solve this problem my code is given below:-
db = canDatabase("J1939.dbc")
pgMultiFrame = j1939ParameterGroup(db, "VehicleDataMulti")
txCh = j1939Channel(db, "MathWorks", "Virtual 1", 1)
rxCh = j1939Channel(db, "MathWorks", "Virtual 1", 2)
start(rxCh);
start(txCh);
transmit(txCh, pgMultiFrame)
pgRx = receive(rxCh, Inf)
when i am going to run this code such kind of warning has been shown
Warning: Transport protocol transmission timed out waiting for Clear To Send notice.

Risposte (1)

Anurag Ojha
Anurag Ojha il 25 Gen 2024
Hello Kuber,
According to the warning message after transmitting the multiframe message, you might need to wait for and handle the CTS response explicitly.
Kindly refer to the pseudo code below to handle the CTS response explicitly and modify it as per your requirements.
transmit(txCh, pgMultiFrame)
% Wait for CTS response
ctsResponse = receive(rxCh, Inf);
% Check CTS response and proceed accordingly
if ~isempty(ctsResponse) && ctsResponse.PGN == j1939ParameterGroup.PGN_CTS
% Process CTS response
disp('Received CTS. Proceeding with data transmission.');
% Continue with the data transmission steps
else
% Handle case where CTS was not received
disp('Did not receive CTS. Transmission may have failed.');
end
I hope this helps!

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by