Detect broken CAN wire from PCANbasic API.

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
LudovicC
Posts: 9
Joined: Thu 19. Sep 2024, 16:44

Detect broken CAN wire from PCANbasic API.

Post by LudovicC » Wed 2. Apr 2025, 11:49

Hello,

If I use two USB PCAN FD devices to send messages to each other (with the PCAN Basic API), would the communication still work if one of the CAN wire gets broken? I guess it depends if you use a fault-tolerant transceiver?
If the CAN communication would still work, would is there a way from the PCAN Basic API to detect that something is wrong?

Thank you in advance!

Best regards,
Ludovic

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Detect broken CAN wire from PCANbasic API.

Post by M.Maidhof » Wed 2. Apr 2025, 14:53

Hi,

with PCANBasic API you can just detect the error frames or error status messages, but there is no option to directly detect a broken wire. When using a fault tolerant CAN transceiver, there is a output pin which will inform about such a wire problem. However, these outputs are typically put on LEDs and could not be read by the API with our PCAN-TJA1054 Converter.

regards

Michael

LudovicC
Posts: 9
Joined: Thu 19. Sep 2024, 16:44

Re: Detect broken CAN wire from PCANbasic API.

Post by LudovicC » Wed 2. Apr 2025, 17:54

Thank you Michael for your fast feedback.

Actually I don't need to have a flag "broken wire", I just need to be able to detect that something is wrong (even if I don't know for sure whether the rootcause is a broken wire or something else).
So have I understood correctly that if a wire is broken, I could find out that something is wrong using the GetStatus from the PCANBasic API which would return (I guess) BusHeavy, BusLight, BusPassive, BusWarning, or BusOff?

I also see in the documentation the PcanParameter "AllowErrorFrames" to activate the reception of error frames, but it's not clear for me how these error frames are then readable through the PCANBasic API?

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Detect broken CAN wire from PCANbasic API.

Post by M.Maidhof » Thu 3. Apr 2025, 13:44

Hi,

PCANBasic will set the status messages and the error frames in the receive queue, like a normal CAN message, just the MESSAGETYPE of thise messages is different. See help of PCANBasic API -> CAN_Read() section for more details.

regards

Michael

Post Reply