How to set CAN Bus speed over 500kbps?!?

1 view (last 30 days)
Babak
Babak on 11 Jun 2019
Hello guys, I am using 2ports NI CAn interface and configure them as a receiver (Port1) and a transmitter (Port2). and I can communicate between these two ports up to 100,000bps. Any value over that cannot be received by port 1?! Why is that?
Here is my code:
clc
clear all
BusSpeed=200*1e3;
%canHWInfo
rxCh = canChannel('NI','CAN1'); %Create a Receiving Channel
txCh = canChannel('NI','CAN2'); %Create a Transmiting Channel
configBusSpeed(rxCh,BusSpeed)
configBusSpeed(txCh,BusSpeed)
% canMessage %
messageout = canMessage(3333,true,5)
% Pack a Message %
pack(messageout,10,0,16,'LittleEndian')
% Start channels %
start(rxCh)
start(txCh)
% Transmit a Message %
transmitPeriodic(txCh,messageout,'On',1);
%% Receive a Message %
rxMsg = receive(rxCh, Inf, 'OutputFormat', 'timetable')

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!