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.

DCAN of TMS570



Hello,

I have some questions about the DCAN cell.

1) I need to get the bus-off and and wakeup interrupt, so I need to configure the EIE and SIE bit to get the interrupt on this cases.

But I also configure the Mailbox for reception with filtering, so I also have some interrupts due these mailbox.

My question is how to not get the status interrupt of RxOK and TxOK, because I don't need them. This makes a high number of DCAN interrupt for nothing, since I get interrupt for every CAN frames on the bus, even if thoses frames are not received by my node. I just want to manage the mailbox interrupt and error and wakeup.

2) I want to disable the automatic retransmission by setting the DAR bit. This is ok for me.

How can I know if the frame is not transmitted due to error or arbitration loss? is there an interrupt in this case? How can I make the difference between the cases?

Thanks for your feedback.

  • Damien,

    On 1)

    I am copying our DCAN expert for this point.

    On 2)  See highlighted section below:

    Section - 27.8.3 Transmission of Messages in Event Driven CAN Communication in the TRM

    If Automatic Retransmission mode is disabled by setting the DAR bit in the CAN Control Register, the behavior of bits TxRqst and NewDat in the Message Control Register of the Interface Register set is as follows:

     

    • When a transmission starts, the TxRqst bit of the respective Interface Register set is reset, while bit NewDat remains set.
    • When the transmission has been successfully completed, the NewDat bit is reset.

    When a transmission failed (lost arbitration or error) bit NewDat remains set. To restart the transmission,

    the application has to set TxRqst again.

     

    Regards,

    Abhishek

  • Damien,

    For #1, it is not possible to disable the interrupt triggered by TxOK and RxOK only.  The SIE bit control the interrupt enable for WakeUpPnd, RxOK, TxOK.  I am curious that if you don't use RxOK, how do you know you have just receive the RX message successfully?

    For #2, you can look at the LEC codes in the status register to know which kinds of error (e.g. bit0 / bit1) you encounter. Bit1 error indicate that you are having a bit error outside of arbitration field.  Bit0 error indicates that the bus got stuck at 1 due to short on CAN lines.  There is no error during arbitration because all nodes try to send and evaluate to determine who the winner is.  Bit error will fore sure occurs during arbitration time, so no reason to report it.

  • Hi,

    For #1, it sounds strange for me that every CAN frames on the bus will generate a status interrupt (if activated of course) even if there is no matching mailbox configured in reception. This will generate a high CPU load due to these useless interrupts.

    When I want to receive a CAN frame, I configure a Mailbox for reception with identifier filtering (full CAN) in order to get an interrupt only on the corresponding mailbox, this is working well. DCAN_INT tells you which Mailbox generates the interrupt, so I know that I have received a CAN frame (and I also know the identifier) like this.

    In general, I use the mailbox 1 for transmission only, and all the others for reception according the messaging of the ECU.

    For #2, I agree for the management of bot0/bit1 error, but this is not my purpose. I need to be in single shot mode on error only, so I need to know if there Tx is not ok, why, in order to send again the frame if it was due to arbitration loss.

    I have seen the documentation, but what I wanted to say (know), it that is there an interrupt source linked with this event : arbitration loss.

    For example, I have made some test this morning, if I disable the status interrupt, then no interrupt is generated at all after an arbitration loss. There is no event linked to this to prevent of an arbitration loss?

    Thanks for your feedback.

  • Hello,

    I have a big issue with this DAR functionnality.

    I need to be in single shot for error, but not for arbitration loss. (MailBox 1 is used to transmission.)

    So I need to detect the arbitration loss in order to make transmit request again like explained in the documentation.(§24.8.3)

    but, the issue is that when I get a 90-100% bus load (to be sure that there is arbitration loss), the bit DCAN1TXRQ12 and DCAN1NWDAT12 and DCAN1INTPND12 are not set quick enough.

    I cannot find in the documentation how the internal signals are managed in case of transmission/reception with graph (which is always usefull).

    The issue is that I get a status interrupt for RxOK (no problem with this), I use this interrupt to check if I have a arbitration loss with my previous transmission. Sometime (really often), I check and the bits that tell me that there is a arbitration loss (TXREQ = 0 and NEWDAT = 1), and then after I have the DCAN1INTPND12 set to 1!

    So in fact there was no arbitration loss at all, and I  ask again a transmission while IT is pending which block the process...

    Hardware bits are not set synchronised with status and source registers?

    could you explain me how I can be sure that I have an arbitration loss when there is one.

    The fact that the hardware priority of the interrupt is status and then after mailbox doesn't help, because I always have a status interrupt before the MailBox 1 (Tx) interrupt, so sometime the bits are not set quick enough.

    You can check at éscreenshot" for better understanding.

    Thank you for your feedback.

  • Hello Support Team,

    I would like to know if you have an update for me about the DAR bit management and the detection of the arbitration loss with the DCAN cell of the TMS570.

    Maybe someone in the forum else has already experience this kind of the problem in this configuration (no automatic retransmission of the CAN frame), which is, I know, not standard.

    Thanks for your feedback.

  • Hi Damien,

    I am sorry that i am a bit behind schedule on this topic.

    The CAN only interrupt CPU if the receive message passed filter.  It does not make sense to interrupt CPU if message filter fail.  In that case, what does CPU suppose to read?

    I am not aware of arbitration lost interrupt.  Arbitration lost is a very normal nature of CAN protocol and the arbitration is done by h/w at every end of CAN frame.  Why do you need to know arbitration lost?  why do you care?  if you need to be the highest priority to take the bus every time, you need to program your ID to be the highest priority right?  The arbitration lost will not terminate the CAN transmission.  The other errors (bit error, etc) will terminate the CAN transmission.  You got interrupt for other error.

    I am confused on what you are trying to do now.

  • Hello,

    I am quite sure that I get the Status interrupt for RxOK even if I have no mailbox configured to receive the CAN identifier. I agree that I doesn't make sense for me to load CPU, but it seems that this is exactly what is happening.

    There are some CAN protocol (in general Time Triggered based CAN protocol) for which there is a need to be in single shot mode (even if not  conform wit BOSCH CAN spec), and for which we need to make a difference between and error (bit error, CRC...) and an arbitration loss error. I am in this case and I need these features.

    So, OK there is no specific interrupt in this case, it is quite rare and highly dependent on CAN cell implementation, but it seems that we can know by checking bits as described in the documentation. I have done CAN drivers for many CPU (Renesas, Freescale, Microchip, Toshiba, STMicroelectronics...) and the implementation of single shot is never done in the same way, TI implementation is different, this is not a problem for me if the mechanism are implemented, we should be able to make what we need.

    It is simple in fact, I just need to be in single shot (with DAR bit = 1) AND be able to detect the lost of arbitration in a consistent way.

    The description done in the documentation is not working as explained two messages ago, it seems that the I cannot be sure 100% of the detection of arbitration loss, there is bad detection of false-positive and false-negative arbitration loss because of flags that are not set "at the same time".

    Are you able to make a test by reproducing the manipulation? Until you have not make the test, it is quite difficult to understand what is happening, that is why I have made a "screenshot" so that it could me a bit more clear for forum readers.

    Thanks for your feedback.

  • Damien,

    Let me double check again and get back with you.

  • Hi Damien,

    Sorry for my late response since i have to go back to the DCAN IP provider and confirm with them a certain things.
    Now, i think i got the answer for you.

    #1- Yes, you are right.  The RxOK will be set regardless if the RX message is accepted or not.  This is not intended to be used for filter accepted RX message indication.   RxOK is intended more for monitoring CAN bus activity.  The RxIE which is the message object interrupt should be used by your application.  This is interrupted if the message is accepted to the message RAM.

    #2- The IP provider also confirm that the arbitration loss is not regarded as an error, therefore, there is no flag for it.  If you want to detect this in software, it is suggested that you need to monitor TxRqst and NewDat bits to check on whether the transmission was started and whether the transmission is completed.  You may have to wait for two transmission time then check for LEC value and TxRqst & NewDat bit.  Reason to wait for two transmission time is that when you trigger transmit, the DCAN maybe in receiving mode at the time.  So, it will complete the RX message, then start the TX message.

    If the TxRqst = 0 and NewDat=1 and LEC=0 after waiting for 2 transmission time, then it is a lost arbitration.

    If the TxRqst = 0 and NewDat=1 and LEC/=0 after waiting for 2 transmission time, then it is a frame error.

    According to the IP provider, the disable of automatic retransmission only makes sense if you are doing time-triggered communication where a message may not be repeated outside of the time window allocated for this message.  Are you in this mode?  If you are in the time window, then, arbitration loss may not be applicable to you.

    Hope this helps.

  • Damien,

    Did you get answers for all your questions? Please let us know so that we can consider this thread closed.

    - Forum support

  • Hello,

    Thanks for you reply.

    I understand now what is occurring in the CAN cell when there is an arbitration loss in the TMS570.

    My application is based on time triggered CAN, that is why I need this functionality.

    I have not yet try a new solution with your explanation of the two frames to wait to be sure of the loss or not.

    I have to experiment this, and I will let you know if it is ok or not.

    thanks

  • Hello support team,

    I have tested your proposed solution to detect the arbitration lost on the DCAN cell. It seems that I can use it in order to manage by requirement about the single shot functionality and arbitration loss detection.

    thank you very much.