python-can icon indicating copy to clipboard operation
python-can copied to clipboard

can.CanError not being raised

Open menroka opened this issue 4 years ago • 2 comments

I have an Ixxat USB-to-CAN V2 hooked up to an embedded system. The system is initially shut down, without any electricity, so there is no way for the CAN to work, because there is only one lonely Ixxat and nothing can send the acknowledgement bit. When calling network.send_message(canID, data) like this:

while tryingToEnterBackdoor:
    try:
        network.send_message(secretID, backDoorData)
        tryingToEnterBackdoor = False
    except can.CanError:    # this error is currently not working as intended
        time.sleep(0.002)

The Ixxat then starts flashing the red CAN LED and the console is outputting "CAN acknowledgment error" in red letters. So far this is expected. However, the function network.send_message does not raise the can.CanError exception and instead we leave the loop instantly.

menroka avatar Nov 02 '21 17:11 menroka

Hey @menroka, what piece of code are you referencing? Is it on the develop branch?

felixdivo avatar Nov 10 '21 13:11 felixdivo

Hi @felixdivo , the referenced code block is something I have written myself using the canopen packet. The send_message function is documented here.

menroka avatar Nov 10 '21 15:11 menroka