CAN Write

05 Apr 2011

The CAN Write function returns a 0 if the write fails and a 1 if the write is successful per the Handbook page below.

What are the conditions that would/could trigger the Write to fail? Is one of the condition if there is no other nodes on the CAN Bus to send a ACK? How long does it wait before returning a failed write, etc..

Thanks

write
    int write(	CANMessage 	msg	)
Write a CANMessage to the bus.
Variables
msg	The CANMessage to write.
Returns
0	If write failed.
1	If write was successful.
06 Apr 2011

anyone?

06 Apr 2011

Hi Kevin,

The only things I know of are as follows...

The CAN Transceiver activate pin is not pulled down to ground (deactivated) The Bus is not terminated correctly

Have you tried the Loopback test to be sure your tranceivers are working? You can do this on a breadboard with two tranceivers and both CAN1 & CAN2 set up. Use CAN1 to TX and CAN2 to RX...

06 Apr 2011

Timothy Stone wrote:

Hi Kevin,

The only things I know of are as follows...

The CAN Transceiver activate pin is not pulled down to ground (deactivated) The Bus is not terminated correctly

Have you tried the Loopback test to be sure your tranceivers are working? You can do this on a breadboard with two tranceivers and both CAN1 & CAN2 set up. Use CAN1 to TX and CAN2 to RX...

I have the CAN channels working just fine. I'm sending and receiving CAN messages like mad!

So I can write "robust code" I need to know exactly what could cause the CAN write to come back with a "fail" condition.