Teensy 3.2 CANbus using MCP2562 in STANDBY mode

Status
Not open for further replies.

Pedro4

New member
I have a 10m long twisted-pair CANbus terminated at each end with 120R. I have two identical nodes, each using a Teensy 3.2 and an MCP2562 transceiver (Vdd=5v, Vio=3v3), operating at 50Kbps. Node 1 just transmits a single message and then awaits any received messages and prints them. Node 2 awaits a received message, prints it, and transmits a single message in response.

This works fine. But I was interested in putting node 2 into STANDBY mode and having it wake up when it receives a message. I can't make this work because node 2 in STANDBY never receives the message sent by node 1 (although its transceiver does).

In more detail, from top to bottom, scope traces are:
node 2 transceiver RXD (yellow)
node 2 transceiver TXD (cyan)
CANH (dark blue)
CANL (magenta)

Here is the one where both nodes are in NORMAL mode. It works, and we see node 2 transmit an ACK:
cantest3b_rx_enabled_msg1.png
Here is the one where node 2 transceiver is in STANDBY mode:
cantest3b_rx_standby_msg1.png
I expect the yellow trace (RXD) to see the message since RXD is active in STANDBY. I expect the recessive voltage levels to be lower since the node 2 transceiver passive load is at 0v rather than Vdd/2. What I did not expect is that the CANbus firwware in the node 2 Teensy would assert (what appears to be) an error frame on TXD. Also, even if the Teensy did assert something on TXD, I did not expect it to appear on the CANbus because node 2 is in STANDBY and cannot write to the bus.

One possibility is that the error frame (if it is one) seen on the CANbus is actually written by node 1 because it has not seen an ACK?? But why then, seperately, is node 2 writing to TXD? BTW node 1 does repeatedly transmit the message because it got no ACK.

More importantly, the software in node 2 Teensy does not see the message (can0.available() never true). I did not really expect node 2 to be able to read the message correctly whilst it is in STANDBY, but I was hoping it would read something, or get some interrupt, so that I can switch the transceiver to NORMAL mode and then recommence normal communications.

Note that for this test I am holding node 2 in STANDBY by wiring STBY pin to 1, the Teensy doesn't actually know that is so.

I have no idea what version of the CANbus library I am using (it is the default). How can I find out?
So my real question is: is there some way I can configure the software so I get a callback when a message is received whilst transciever is in STANDBY?

I don't think the Arduino programs are terribly relevant but extract them below anyway.
Node 1
Code:
void loop(void)
{
  CAN_message_t inMsg;

  while (Can0.available()) 
  {
    Can0.read(inMsg);
    Serial.print("RX: "); hexDump(8, inMsg.buf);
  }
  if (once) {
    once = false;
    msg.buf[0]++;
    Can0.write(msg);
    Serial.println(F("TX"));
  }
  delay(100);
}
Node 2
Code:
void loop(void)
{
  CAN_message_t inMsg;
  while (Can0.available()) 
  { // This loop never executes when transceiver in STANDBY
    Can0.read(inMsg);
    Serial.print("RX: "); hexDump(8, inMsg.buf);
    msg.buf[0]++;
    Can0.write(msg);
    Serial.println("TX");
    delay(100);
  }
  delay(100);
}
 
FlexCAN Library doesn't have wake capability, use FlexCAN_T4 for 3.x/4.x, wakeup support was added awhile ago
 
Thank you. But, as I see it, the problem is that the Teensy hardware thinks the received message (the one in the second picture above) is invalid and hence does not send it to the software, or alternatively it does send it to the software but the software thinks it is invalid and doesn't send it to the user program. Will FlexCAN_T4 get around this problem?
 
the software doesn't handle transfers on the bus, it's all hardware, software only loads the data, then the hardware takes over, you'll need to try it out
 
Status
Not open for further replies.
Back
Top