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.

CAN interrupt problem about TMS470M's Halcogen

Other Parts Discussed in Thread: HALCOGEN

Hi, using tms470m's halcogen, generates program code,and debug can interrupt program,enter interrupt function,don't exit,why? void can1LowLevelInterrupt(void)
{
    unsigned messageBox = canREG1->INT >> 16U;

/* USER CODE BEGIN (43) */
/* USER CODE END */

    /** - Setup IF1 for clear pending interrupt flag */
    while (canREG1->IF1STAT & 0x80);

    canREG1->IF1CMD = 0x08;
    canREG1->IF1NO  = messageBox;

    while (canREG1->IF1STAT & 0x80);

    canREG1->IF1CMD = 0x87;
  //  canREG1->IF1NO  = 1;
    canMessageNotification(canREG1, messageBox);

/* USER CODE BEGIN (44) */
    //canREG1->INT = 0;

    return;
/* USER CODE END */
}

  • Hi,

    Please answer below questions to answer you better

    1) Where does the code gets stuck, is it at the "while (canREG1->IF1STAT & 0x80)"

    2) Do you have canMessageNotification() function inplace?

    If possible can you send snippet of can.c and sys_main file that you are using?

    Best Regards
    Prathap

     

     

  • tks,i have resolved the quetions: using can1 message box  2 for receiving , should read IF2 command register to clear IntPnd bit,but  i read IF1. would you help me to explain IF1/IF2 Command Registers,because don't read received data from IF2DATAA/DATAB,thank you!

  • how to using IF1 and IF2? IF1and IF2 mean?

  • IFx registers are called Interface Registers. The Interface Register sets control the CPU read and write accesses to the Message RAM. There are two nterface Registers Sets for read / write access (IF1 and IF2) and one Interface Register Set for read access only (IF3). Nore information can be found in the "Technical Reference Manual" document.

    You can have a look at the "can.c" generated by Halcogen "canInit()" uses IF regiters to initialize Mailboxs.

    you can use functions like "canTransmit() and canGetData()" to transmit and receive data from a particular Mailbox.

    Ti make it simple, IF registers are more or less simialr to mail box, You fill the necessary configuration and data to IF and select the mailbox number, so that the contenets from IF are moved to corresponding fields in the selected mail box.. vice versa for Read.

  • thank you,i want to say  what's difference between IF1 and IF2?

  • IF1 and IF2 are two instances of the Interface register.. There is no difference.. You can use either one of them.