xcpChannel unable to set bus speed (baud rate)
조회 수: 3 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
Jaskirat
2025년 2월 19일
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!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Motion Planning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!