Unable to Received Multiframe CAN Data In MATLAB
4 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 External Language Interfaces 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!