[Simulink Support Package for Arduino Hardware] CAN Recieve Block issue
Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you.Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you. Hello,
I am a student currently using the Simulink Support Package for Arduino Hardware to implement CAN communication.
The issue I am facing is that the CAN Receive block does not receive any data when messages are sent using an Extended ID. I am using an Arduino MKR WiFi 1010 along with the MKR CAN Shield. My Simulink model is used to send CAN messages to a motor and receive CAN messages from the motor.
The Simulink model (I attach the file.) I created, along with the configurations for the CAN Transmit and CAN Receive blocks, which are shown below. (The Fixed Step Size is set to 0.002.)
To verify the transmitted values, I used a ‘USB to CAN Analyzer’. (link: https://www.seeedstudio.com/USB-CAN-Analyzer-p-2888.html?srsltid=AfmBOooUz103F-Q3hiV6ocaQKvJwR2POvokjnFucYIHxf77tjr7DDkJe) As a result, I confirmed that messages with Extended IDs 0x302 (=770)and 0x2902 (10498) exist on the bus. (0x302: Arduino transmit, 0x2902 Arduino receive)
However, when checking the results from the To Workspace block, I found that no data is being received, unlike what I observed with the USB CAN Analyzer.
To rule out a hardware issue, I also tested with the MATLAB Support Package for Arduino Hardware, and it worked correctly. The MATLAB code (attached) successfully received messages.
clear arduinoMKRObj;
clear rxObj1;
%% MKR
arduinoMKRObj = arduino(‘COM18′,’MKR1010′,’Libraries’,’CAN’)
rxObj1 = canChannel(arduinoMKRObj, ‘MKR CAN Shield’,"BusSpeed", 1000e3)
runtime = 10; % time to read (s)
tic; % start reading
while toc < runtime
% read data
readMsg = read(rxObj1);
if ~isempty(readMsg)
disp(‘Data received:’);
disp(readMsg);
else
disp(‘No data received’);
end
end
What should I do next? Could this be a Simulink-related issue? Any help would be greatly appreciated.
Thank you. simulink, simulink support package for arduino hardware, can, can recieve MATLAB Answers — New Questions