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.

TMS570LS3137: Implement of CAN loopback test

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello.

I want to do CAN loopback test, and searched for similar questions in the community.

I found this thread.https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/257078/907180#907180.

I saw the source code(3005.dcan.zip) in that thread, so I am referring.

So I have questions.

(1) This source code is implement to "24.14.4 Loop Back Combined with Silent Mode"  in Safety Manual(SPNU499B) ?

(2) "IFX[2];" is what indicate?  I think, IFX[0] = buffer for RX,and IFX[1] = buffer for TX.

       After some data in IFX[0] , comparing whether the values IFX[1] and IFX[2] are the same or not ?

Best Regads

  • Hello Arriy,

    I need to look a little deeper into the reference code you linked to before I can answer your questions. I will look at these on Monday and get back to you.

  • Hello Arriy,

    Arriy said:
    1) This source code is implement to "24.14.4 Loop Back Combined with Silent Mode"  in Safety Manual(SPNU499B) ?

    I don't believe that silent mode is being used in this example.

    Arriy said:

    (2) "IFX[2];" is what indicate?  I think, IFX[0] = buffer for RX,and IFX[1] = buffer for TX.

           After some data in IFX[0] , comparing whether the values IFX[1] and IFX[2] are the same or not ?

    The test pass/fail is checked in this funcion:

    unsigned int CAN_TestVerify()
    {
     	 /* Read receive mailboxes */
        unsigned int error;
    #ifdef	DEVICE_MODEL
    	register DCAN_ST *ptr = (DCAN_ST *)DCAN1;
    #else	
    	register DCAN_ST *ptr = &e_DCAN1_ST;
    #endif 
    	error =0;
    
    #if 0
    
       	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.MASK_B1		=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.ARB_B1		=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.CONTROL_B1	=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.CLRINTPEND_B1 =1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.TXREQ_B1		=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.DATAA_B1		=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.DATAB_B1		=1;
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.WR_B1 		=0; //Receive mailbox
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.MSGNUM_B8 = 0x02; //2nd mailbox
    
    #endif
    	
    	ptr->IFX[0].IF1REQ_UN.IF1REQ_UL = 0x007F0002;
    
    	while(ptr->IFX[0].IF1REQ_UN.IF1REQ_ST.BUSY_B1 == 1);
    
    	if(ptr->IFX[0].IFDATAA_UN.IFDATAA_UL!=DCAN_TxData[0]) error++;
    	if(ptr->IFX[0].IFDATAB_UN.IFDATAB_UL!=DCAN_TxData[1]) error++;
        return (error);
    }

    The content of IFX0 is compared to the content of DCAN_TxData[0] and DCAN_TXData[1]. I don't see any references to IFX[2]?

    However, there are 3 IFX registers. Usually IFX3 is used to access all CAN messages as itis the only one tied to the interrupt. For this test purpose it wasn't needed.

    Also, you should be cautious about using some of the older examples. In this case the example does not originate from halcogen so using it in a project could be risky. For sure it would have to be verifiied by you/your company independently to assure it meets the device and application needs. I would highly recommend sticking with either safeTI diagnostic library code or Halcogen generated code only as these can be supported later by the CSPs that TI offeres or, at least you know that the code examples are developed in accordance with IEC61508.

  • Hello Chuck.
    I appreciate your code check.

    I see, this code is too old and not originate from HALCoGen, it is dangerous to reference.
    Is this code doing the processing assumed as CAN loopback tests ?
    ( processing assumed = compare of DCAN_TxData[0] and DCAN_TXData[1] )


    Best Regards
  • Generally speaking, the test implements the loop back test. I don't think it considers any error conditions. i.e., if it is possible that you might need to enhance it to provide additional error condition checking such as introduction of a CRC error or other. If you are using outside of the message mechanisms such as transmission redundancy or information redundancy techniques, these should also be checked. It would be best if your receive handler was actually used as it would be in realtime use of the application. i.e., keep as much of the code used for test the same as that used for the application.
  • Hello Arriy,

    Again, if my post sufficiently answered your questions, please use the green verify answer button to let us know so that we may close the thread.