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
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: