CAN bus sporadic failure

Status
Not open for further replies.

Edward

Well-known member
Hi All,

so I'm working on a project that uses the CAN bus for some command/control and I'm getting an inconsistent problem.
I'm using the flexCAN library by teachop, and a T3.2. In the setup another T3.2 is connected to the other end of the bus, pretending to be the computing module (ergo I'll refer to it as the master to disambiguate)

Sometimes, the CAN bus fails to write properly from bootup. There's a "handshake" on bootup, where the teensy sends the same message to the master until it receives an appropriate response. I see the calls to Can0.write() execute, the buffers fill up and the function begins to return 0. Looking at the CAN lines on a scope, I can physically see there's no signal present. Notably, messages from the master are still received and handled properly.
The behaviour is the same as if the CAN bus was disconnected, where the calls to write eventually fill up all the buffers and don't get sent.

Reprogramming the teensy seems to fix the problem when it occurs. I've tried calling end() and then begin() to reset the bus, but to no avail. I realise that without a repeatable problem, solutions have to be best guesses but

- Does anyone have an idea of what can cause CAN to receive but fail to send?
- Is there a way to hard reset the CAN bus, without resetting the T3.2 itself.

I'll add any more information as I get it,

EDIT1: I also get the same behaviour if I call Can0.write(message) in an infinite loop, and the tx remains locked after I stop calls

thanks
 
Last edited:
Could be a power up problem. How are you powering the T3.2 and the CAN transceiver ?

Post the schematic and some photos of the setup.
 
oh, that's embarrassing. I'm supplying my CAN transceiver 3.3 when it needs 5V, that certainly would explain why it's being sketchy. I'll rework the board and see if the problem resolves itself!
 
Status
Not open for further replies.
Back
Top