フィルターのクリア

Unable to Received Multiframe CAN Data In MATLAB

4 ビュー (過去 30 日間)
Kuber Dwivedi
Kuber Dwivedi 2022 年 5 月 3 日
回答済み: Anurag Ojha 2024 年 1 月 25 日
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.

回答 (1 件)

Anurag Ojha
Anurag Ojha 2024 年 1 月 25 日
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!

カテゴリ

Help Center および File ExchangeVehicle Network Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by