Before that I used to do it in a for loop to set 4 channel;$ cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20240521_n (8.18.0) Dec 13 2024 16:57:39 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [usb] --------------
*--------------------- 4 interfaces @ major 505 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
0 pcifd -NA- d391000 380 0x001c 00000001 00000000 00000039 00000380 0x0000
1 pcifd -NA- d392000 380 0x001c 00000000 00000000 00000000 00000000 0x0000
2 pcifd -NA- d393000 380 0x001c 00000000 00000000 00000000 00000000 0x0000
3 pcifd -NA- d394000 380 0x001c 00000000 00000000 00000000 00000000 0x0000
now I'm trying to remove LISTEN_ONLY mode and write message to my CANBUS line by doing;Init_CAN(UINT8 channel_ID)
{
TPCANBaudrate baudrate = PCAN_BAUD_500K;
DWORD parameter_value = PCAN_PARAMETER_ON;
UINT32 parameter_status = CAN_SetValue(CAN_device, PCAN_LISTEN_ONLY, ¶meter_value, 4);
INT32 CAN_device = PCAN_PCIBUS1 + channel_ID;
UINT32 status = CAN_Initialize(CAN_device, baudrate, 0, 0, 0);
return status;
}
when I run the code and check canAnalyser3 Mini it sayswhile(true){
TPCANHandle pcan_handler = PCAN_PCIBUS1;
TPCANBaudrate baudrate = PCAN_BAUD_500K;
TPCANStatus status;
status = CAN_Initialize(pcan_handler, baudrate);
TPCANMsg msg;
msg.ID = 0x123;
msg.MSGTYPE = PCAN_MESSAGE_STANDARD;
msg.LEN = 3;
msg.DATA[0] = 1;
msg.DATA[2] = 2;
msg.DATA[2] = 3;
status = CAN_Write(pcan_handler, &msg);
CAN_Uninitialize(pcan_handler);
}
ID(hex) = Error
DLC = 1
Data(hex) = 80h: TX | stuff error
I tried to change msgtype to PCAN_MESSAGE_EXTENDED and set the analyser mini for the extended data but nothing changed. At first, when the LISTEN_ONLY is set I can read data from the line but when I remove it all I get is error can't send any data to the line