xcpChannel unable to set bus speed (baud rate)

조회 수: 3 (최근 30일)
Johan
Johan 2025년 2월 6일
댓글: Johan 2025년 2월 24일
I can't find a propper way to set the busspeed when using xcpChannel function. The bus speed is defined in the a2l object that I pass to the function but it still sets the default bus speed (500 kbit/s). When creating a canChannel object I can set the bus speed with the function configBussSpeed() but this can't be used on a xcpChannel object.
The only way I could set the bus speed was to set a break point in the underlying function and call the configBusSpeed function in debug mode.
I have tested with Vector, Kvaser and PCAN usb dongles. Same result, i.e. default bus speed is set.
Is this a bug, since the bus speed is clearly defined in the A2L object? Or how do I set the bus speed in a propper way?

채택된 답변

Jaskirat
Jaskirat 2025년 2월 19일
Hello @Johan!
There does not seem to be a direct way to use the “configBusSpeed” function with an xcpChannel object. A workaround would be to create a CAN channel and configure the bus speed before establishing the connection on XCP over CAN.
% Step 1: Create a CAN channel
% Replace 'VendorName', 'Device', and 'ChannelNumber' with your specific parameters.
canChannelObj = canChannel('VendorName', 'Device', ChannelNumber);
% Step 2: Configure the bus speed
% Set the desired bus speed in kbit/s, e.g., 250 kbit/s.
configBusSpeed(canChannelObj, 250000);
% Step 3: Create an XCP channel using the configured CAN channel
% Load your A2L file
a2lObj = xcpA2L('path_to_your_file.a2l');
% Create the XCP channel
xcpChannelObj = xcpChannel(a2lObj, canChannelObj);
% Step 4: Connect to the XCP server
connect(xcpChannelObj);
Hope this helps!
  댓글 수: 1
Johan
Johan 2025년 2월 24일
Thank you for a workaround. It would be helpful if the baudrate coud be set automatically with the information fetched from the A2L file and stored in the a2lobject in the future.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Motion Planning에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by