This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS470MF06607: DCAN error handling

Part Number: TMS470MF06607

hi ,

i am using TMS470MF06607 microcontroller.

i am using both the CAN in that controller. now my code is running properly with interrupt handler also.

but i want to know how to clear my error .

ex :  now i am transmit or receive  some data continuously , in between i remove my receiver or transmitter.  my controller is keep on try to transmit or receive the data. that the time some error flags are raised in the registers like CTRL, ES, ERRCNT

 i used watch dog timer also in my code. after the code reset also these flags are not cleared . 

so can you please give some suggestions and example for how to clear those errors in my software.

regards

Arun Kumar.N

  • The bulk of the error flags in the DCAN ES register are read cleared. i.e., they are cleared when you read the register. The remaining bits are status bits and are cleared when the condition is removed. For example, if Bus OFF is active, it will be cleared when the device successfully comes out of the buss OFF state. More on Bus OFF recovery can be read from the TRM.

    If the reset is caused by an external assertion of the nRST pin, I would not recommend assuming operation of any of the peripherals without proper re-initialization of the module including a module level reset. The module reset should clear any existing errors and allow re-entry onto the bus once the bus off recovery is completed.
  • hi sir,

    you are suggest that maximum DCAN ES registers are read cleared, but i don't know how to clear that errors.
    from the software side where i want to do the changes. i thought i want to do some changes in the CAN ERROR NOTIFICATION FUNCTION.
    but i am not sure it is correct or not.
    the reset is not happen external nRST pin. because of the watchdog timer only i make that reset. while i did through the watchdog timer means this error flags are not cleared.

    regards
    Arun Kumar.N
  • Hello Arun,

    The DCAN ES register is not a "sticky" register and is not retained through any system level reset whether is be a soft reset of hard power on reset. If the registers contain any values after the nRST assertion, it is either a remnant because you have not re-initialized the DCAN module for operation after the reset or because there is still some errors on the bud. Remember that the status register is reflecting the state of the bus as well as the local module. Other members of the network can and will send error frames on the bus that will affect this register.

    Also, to be clear, when you state that you are using a watch dog in your controller, are you using the Hercules internal watchdog or an external watchdog connected to nRST?
  • hi sir,

    sorry for this delayed response.
    actually i am using the Hercules internal watchdog reset. so if i am re-initialized the CAN module means this error flags are cleared ???

    regards
    Arun Kumar.N
  • Any type of reset with the exception of a CPU reset, will result in a soft reset of the device which propagates to all peripherals. In some cases such as the flash wrapper, ram wrapper, ESM, etc. there are error conditions that are latched through soft reset so that the reset can be used as a correction mechism if there are uncorrectable and/or critical errors that can impact device operation including primarily program flow. DCAN is not considered one of the types of modules so a soft reset as asserted by the internal watchdog of the device should also reset the DCAN module which would then need to be re-initialized just as it would going through a power on reset.
  • hi sir,

    thank you for your valuable suggestions. now i understood . so the watchdog timer reset is not clear the CAN error flags. if i want to clear means i want to re-initialize that CAN module right.

    thank you sir.

    regards
    Arun Kumar.N
  • The CAN error flags should be cleared even on a WD reset. If there are still errors on the CAN bus, after the reset, the status flags may be set again. This would be a result not of the MCU DCAN module but of other nodes on the network in case they are sending error frames to shut down the CAN bus and notify its nodes of the issues.

    If you have gone through any reset, soft or hard, you would need to reinitialize the all of the peripherals including DCAN.