Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Automotive CAN Bus acting weird (FlexCAN_T4)

  1. #1
    Senior Member
    Join Date
    Jun 2014
    Posts
    258

    Automotive CAN Bus acting weird (FlexCAN_T4)

    Hi everyone.

    I'm trying to read the CAN data from an automotive part, which is going fine, but I have one weird finding.
    Every 6 seconds or so, the CAN data stream stops for about 1 second. I don't think this is standard behavior, I think the CAN controller may be restarting. I can see a slight current drop on its input.
    I am sending the example's random message to keep the bus alive, otherwise all communication shuts down.

    Code:
        msg.id = random(0x0,0x00);
        for ( uint8_t i = 0; i < 8; i++ ) msg.buf[i] = i + 1;
        Can0.write(msg);
    Has anyone seen anything similar before? Is this a matter of sending the wrong keep-alive message? Bad message timing?
    Thanks!

  2. #2
    Member
    Join Date
    Aug 2018
    Location
    Brisbane, Australia
    Posts
    85
    In my experience you shouldn't need to send anything to "keep the bus alive", you just need to make sure that every message sent is ACK'ed by somebody.

  3. #3
    Senior Member
    Join Date
    Jun 2014
    Posts
    258
    It's a "passive" component, a control joystick for the entertainment console.
    I do think it makes sense to keep-alive as it has no other way of knowing the state of the car (permanent 12V, gnd, CAN). I don't have access to the car right now to confirm, but in some other cars I've dealt with, a quiet bus meant that many components went to sleep. The entertainment bus may be different to other crucial buses.

    I sort of confirmed this by setting the tx message to repeat after 2 seconds and the module goes to sleep between transmissions (almost no current flow).

  4. #4
    I would generally not recommend sending random stuff on the CAN bus to keep it alive. If the device needs traffic to keep it alive then find out a representative message that would normally be on the bus and just keep sending that. Sending on random IDs might do strange things. But, you have random (0, 0) which means you are always sending on ID 0. This is technically valid to do. You can use ID 0. But, did you really mean to do that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •