This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with CAN

Dear sir
presently we are doing an automotive project using LPC2368 controller.
We are developing a receiver system which receives CAN messages from the
CAN Network.
We wants to implement the error handling in our project. We have to
handle two errors in our system
1> Data Over-run
2> Error passive

We have written the codes for these errors but we are unable to get
those errors in our system and we dont know exact procedure to simulate our
code. Can you please provide some test codes so that we can generate these errors
and handle them in an effective way.

And also we want some information regarding resetting of CAN controller
Weather we have to reconfigure the CAN controller ( CAN initialization &
Acceptance filter ) after bus off event or CPU initiated bus off event.
Or previous configurations will be Reloaded (ie previously set baud-rate ,
Acceptance filter etc )

Thanks & Regards
Giridhar

Parents
  • Besides simulating incoming Messages and Remote Frames via Virtual Register CANxIN you can also simulate CAN errors.

    Following is the description of the Virtual Registers for CAN in LPC devices:

        CANxIN and CANxOUT Values (x = 0, 1, .. 6):
          1 - Message with 11-bit ID
          2 - Message with 29-bit ID
          3 - Remote Frame with 11-bit ID
          4 - Remote Frame with 29-bit ID
          5 - Bus Activity Start
          Arbitration Loss (captured in CANICR):
            Bit  5:    1
            Bits 0..4: ALCBIT
          Bus Error (captured in CANICR):
            Bit  8:    1
            Bits 0..4: ERRBIT
            Bit  5:    ERRDIR
            Bits 6..7: ERRC
    


    Errors are captured in the CANxICR register. So to simulate a CAN error you just need to write the appropriate command into the CANxIN (from the command window).

    Examples:

    CAN1IN = 0x2C;  // Arbitration Lost (in IDE bit): ALCBIT=12
    CAN1IN = 0x18A; // Stuff Error in Data Field while transmitting: ERRBIT=10, ERRDIR=0,ERRC=2
    

Reply
  • Besides simulating incoming Messages and Remote Frames via Virtual Register CANxIN you can also simulate CAN errors.

    Following is the description of the Virtual Registers for CAN in LPC devices:

        CANxIN and CANxOUT Values (x = 0, 1, .. 6):
          1 - Message with 11-bit ID
          2 - Message with 29-bit ID
          3 - Remote Frame with 11-bit ID
          4 - Remote Frame with 29-bit ID
          5 - Bus Activity Start
          Arbitration Loss (captured in CANICR):
            Bit  5:    1
            Bits 0..4: ALCBIT
          Bus Error (captured in CANICR):
            Bit  8:    1
            Bits 0..4: ERRBIT
            Bit  5:    ERRDIR
            Bits 6..7: ERRC
    


    Errors are captured in the CANxICR register. So to simulate a CAN error you just need to write the appropriate command into the CANxIN (from the command window).

    Examples:

    CAN1IN = 0x2C;  // Arbitration Lost (in IDE bit): ALCBIT=12
    CAN1IN = 0x18A; // Stuff Error in Data Field while transmitting: ERRBIT=10, ERRDIR=0,ERRC=2
    

Children
No data