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.

TMS570LS1224: CAN Loopback Tests

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Hello,

I am trying to create CAN loopback tests. I prefer CAN internal loop back. Here the manual says that the transmitted message is treated as 

receive message  and can be stored into message objects if they pass acceptance filtering.

My goal was to test the acceptance filtering set in my code by way of loopback tests. Is this possible by way of the internal loopback tests ?

  • Yes, you can use loopback to check the acceptance filtering.  

  • Hi, Thank you for your reply. I did tried this yesterday and hence I wrote the mail. It seems not working. Not sure Where I am going wrong.
    I had set the controller in loop back mode with :
    canEnableloopback(canReg1, Internal_Lbk);

    In Halcogen had set the Message 14 in Tranmsit node.
    I had set the mask as 0x00000000 and ID as 0x119 generated the code.

    I has sent the message with:
    Can ID - 0x120
    CAN message box number - 14 (same as transmit since it s a loop back mode.
    and data bits.

    But it seems to accept the messsage and I can see the receive message via loopback.  I was expecting it to reject the loop back transmit message.

    Is this the expected way of working or I am doing any thing wrong here ?

  • Please use different message box for receive.

    If msk[28:0]=0x0000000, the identifier of the message object is not used for acceptance filtering, this message box can receive message with different IDs.

    for example, Msg box1 transmits data with ID=119

    Msg box3 transmits data with ID=121

    Msg box5 transmits data with ID=123

    The Message Box 2 is configured to receive data, the msk of this object is 0x0000. This msg box will receive data from msg box 1, 3, and 5.

  • #define D_SIZE 8

    uint8 TX_DATA1[D_SIZE]={1,2,3,4,5,6,7,8}; /* transmit buffer in sys ram */
    uint8 TX_DATA2[D_SIZE]={11,12,13,14,15,16,17,18}; /* transmit buffer in sys ram */
    uint8 TX_DATA3[D_SIZE]={21,22,23,24,25,26,27,28}; /* transmit buffer in sys ram */
    uint8 RX_DATA1[D_SIZE]= {0}; /* receive buffer in sys ram */
    uint8 RX_DATA2[D_SIZE]= {0}; /* receive buffer in sys ram */
    uint8 RX_DATA3[D_SIZE]= {0}; /* receive buffer in sys ram */

    uint32 CAN_Comp_Flag = 0xAAAA5555;
    /* USER CODE END */

    int main(void)
    {
    /* USER CODE BEGIN (3) */
    /* initialize can 1 */
    _enable_IRQ_interrupt_();

    canInit();

    canEnableloopback(canREG1,Internal_Lbk);


    /* transmit on can1 */
    canTransmit(canREG1, canMESSAGE_BOX1, TX_DATA1);

    /* Wait for the DMA interrupt ISR to set the Flag */
    while(CAN_Comp_Flag != 0x5555AAAA);

    /* Reset the Flag */
    CAN_Comp_Flag = 0xAAAA5555;

    /* transmit on can1 */
    canTransmit(canREG1, canMESSAGE_BOX3, TX_DATA2);

    /* Wait for the DMA interrupt ISR to set the Flag */
    while(CAN_Comp_Flag != 0x5555AAAA);

    /* Reset the Flag */
    CAN_Comp_Flag = 0xAAAA5555;

    /* transmit on can1 */
    canTransmit(canREG1, canMESSAGE_BOX5, TX_DATA3);


    /* Run forever */
    while(1);

    /* USER CODE END */

    return 0;
    }


    /* USER CODE BEGIN (4) */
    void canMessageNotification(canBASE_t *node, uint32 messageBox)
    {
        CAN_Comp_Flag = 0x5555AAAA;
        if(node==canREG1)
        {
             canGetData(canREG1, canMESSAGE_BOX2, (uint8 * )&RX_DATA1[0]); /* copy to RAM */
        }
    }

  • Thank you very much for your support. It has helped me very much. 

  • if your question is answered, please click "resolved", thanks