I am using the PCAN-Basic API Library in LabView and realise, that the functions CAN_Read & CAN_Write don't send an error notice, if I just unplug the PEAK-CAN cable after the Bus is initialized. I would expect a "PCAN_ERROR_BUSOFF" Error, but nothing appears. Without the error, my program doesn't react and just works like everything is fine.
I hope, you can help me. Thanks in advance.
Are you using the LabVIEW Driver? For questions and further information about the LabView driver, please contact Mr. Kunze: support[at]digiinst.de.
If you have written your own virtual instrument (VI), then we unfortunately do not offer support for this.
thanks for the quick answer!
I spoke with Mr. Kunze and he explained me, that the functions just transfer the error from the Peak-CAN system. He supposed about a problem in the CAN-Bus. Actually, the same Error in Peak-CAN View shall to appear in the LabView programm, but it isn't the case. Have you an idea, how is this effect possible?
Thanks in advance.
PS: Übrigens, wenn es für Sie lieber wäre, können wir uns auch gern auf Deutsch schreiben!
thanks for your proposal, but it is better to maintain the language in english so other users with similar problems can also find help in this post.
Because you disconnect the CAN cable doesn't means that you will get a BUS_OFF. This error occurs in other situations, for instance, when you shortcut the CAN bus (CAN-H and CAN-L connected together). About when and which CAN error occurs, it is explained in this post, BUSLIGHT, BUSHEAVY & BUSOFF.
About errors returned by CAN_Read and CAN_Write:
- CAN_Read will returns QUEUE_EMPTY, when no messages are available to be read. Otherwise you get a message from the client queue and the error returned is OK, if it was a normal message, or, if the status of the CAN bus is other than OK, then this status is returned as error code. This happens only if you are receiving status frames or error frames (without receiving messages you will still received QUEUE_EMPTY. By the way, in those status messages is the current CAN bus state coded in their data field too (BUSLIGHT/WARNING/PASSIVE/BUSHEAVY/BUSOFF).
- CAN_Write will return OK, as long as the message could be written in the send queue of the driver or, in some cases, BUS_OFF (if this error is currently active). In your case (cable disconnected), the CAN status error occurs after the message was put into the queue, so you still receive an OK as return code.
I just tested with a PCAN-Basic sample and CAN_Read is returning the right error code when the CAN bus is not OK, so I cannot tell you what you are seeing always and OK. Please check that PCAN-Basic is up to date. If not, then install the last version and try again.Antonio wrote:Actually, the same Error in Peak-CAN View shall to appear in the LabView programm, but it isn't the case. Have you an idea, how is this effect possible?