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.

CCS/RM48L952: how the pending message (trREQX)in CAN transmitting

Part Number: RM48L952
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

 the used IDE is CCS 6.2 for Hercules,the CAN communication Driver is generated by HALcogen。

i send 128 package of 10byte once,and call the canTransmit() one in the main program ,and other 127 packages tramnit in the can interrupt notification。i use the messagebox1 for trasmit 。

somtimes  in canTransmit() function the return values is 0, see the picture below :

but the TxOK bit in the ErrStat is 1 , and no other can bus errs. the cantramsit ()is in the main program . when this appears , i try to call the canTransmit()  in a while loop,but nothing works.

my question is why there is pending message ? what flags should i check to  ensure the err free can transmition?

  • Hello,
    Are you trying to send 10 bytes at a time? The maximum payload of CAN (not CAN FD) is 8 bytes.
    Could you share some parts of your code?

    Best regards,
    Miro
  • i use can2.0A , ten bytes include 8 byte data and 2 byte ID

  • Hello,
    Could you share some code or CCS and HALCoGen projects?

    Best regards,
    Miro
  • appmain(void)
    {
    uint32_t MainTime = 0U;
    uint32_t RunFlag = 0U;
    uint8_t FeedDogFlag = 6U;

    RtiInit();
    CanInit();
    while(1)
    {
    unsigned int temp122;
    temp122=cansendfinish(canREG1);//read the err and status registor ES

    ClearIObuf();
    {
    if((temp122&0x80)!=0x80) //can is not off line
    CommIORcv(); //can 接收
    else
    {
    ;
    // cout11[0]=0x11;
    // cout11[1]=0x11;
    // cout11[2]=0x11;
    // cout11[3]=0x11;
    }
    }
    if((tx_data_full==0U)&&((temp122&0x80)!=0x80)) // send package number is ok and ES registor is TXOK
    {
    if((((temp122 & 0xE0)!=0x00)||(((temp122&0x07)!=0x07)&&((temp122&0x07)!=0x00)))&&(fistcout==0))
    {
    // cout11[0]=temp122&0xFF;
    // cout11[1]=temp122&0xFF;
    // cout11[2]=temp122&0xFF;
    // cout11[3]=temp122&0xFF;
    fistcout=1;
    // return;
    }
    if(((temp122&0x08)==0x08)||((temp122&0x07)==0x07)) // no can error then send data
    CommIOSnd();
    }

    }

    /*RUN 运行灯*/
    if(RunFlag==1U)
    {
    RunFlag = 0U;
    }
    else
    {
    RunFlag = 1U;
    }
    hetio(22U,RunFlag); /*点运行灯*/

    /*A-MS/B-MS 主从*/
    if(CPU1 == OwnStatus.CPU1orCPU2)
    {
    hetio(24U,1U); /*点主从指示灯*/
    }
    else
    {
    hetio(24U,0U);
    }

    hetio(9U,1U);
    hetio(9U,0U);
    }
    }

    void CommIORcv(void)
    {
    rpaks = RecvCan(); /*收数>>rcvCan[i]*/
    }

    static uint16_t RecvCan(void)//13370164196 钟
    {
    const uint8_t rcvcanbuf[10*MAX_MODUS] = {0U}; /*receive buffer*/
    uint16_t rcvlen = 0U; /*receive length*/
    uint16_t i = 0U;
    uint16_t j = 0U;
    uint16_t k = 0U;
    uint16_t TotalLen = 0U;
    static uint32_t rerr_cnt = 0U; /*timer counter for communition break */
    static uint8_t canrcverr = 0U; /*CAN receive err*/
    g_RcvCanlen = 0U; /*0*/

    if(rerr_cnt==0U)
    {
    rerr_cnt = tickGet();
    }
    do
    {
    rcvlen = (uint16_t)CanRecive(rcvcanbuf,10U*((uint32_t)MAX_MODUS)); /*接收CAN数据包*/
    if(rcvlen == 0U) /*20160518 gg*/
    {
    if(GetElapse(rerr_cnt)>3000U) /*3s,判断是否3秒未收到数,若是则判通信中断*/
    {
    OcuErr=ERR_CANRCV;
    canrcverr = 1U;
    }
    }
    else
    {
    rerr_cnt = tickGet(); /*记录收收的时间*/
    }

    k = 0U;
    while(((k*10U)<rcvlen) && (i<(uint16_t)MAX_MODUS)) /*逐包处理接收的数据*/
    {
    rcvCan[i].id=0U;
    rcvCan[i].id |= (uint32_t)(((uint32_t)rcvcanbuf[k*10U+0U])<<3); /*提取CAN ID*/
    rcvCan[i].id |= (uint32_t)(((uint32_t)rcvcanbuf[k*10U+1U])>>5); /*提取CAN ID*/
    rcvCan[i].dataLen = rcvcanbuf[k*10U+1U] & 0x0FU; /*提取CAN 数据包长度*/
    for (j = 0U; j <(uint16_t)rcvCan[i].dataLen; j++) /*提取CAN 数据*/
    {
    rcvCan[i].data[j] = rcvcanbuf[k*10U+j+2U];
    }
    /////////////////////////////////判断序号连续
    uint16_t crc = 0U; /*CAN 数据crc*/
    crc = CRC16((uint8_t *)(&rcvcanbuf[k*10U+0U]), 8U); /*计算crc*/
    if((((crc>>8)&0xFF)==rcvcanbuf[k*10U+8U])&&((crc & 0xFF)==rcvcanbuf[k*10U+9U]))
    {
    if((rcvcanbuf[k*10U+3U]==0))
    {
    cout[0]++;
    if(cout[1]>0)
    {
    if((cout[1]!=128)) // 判断 cout【2】
    {
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[1]=(unsigned char)cout[1];
    }
    cout[1]=0;
    }
    }
    if((rcvcanbuf[k*10U+3U]==2))
    {
    cout[2]++;
    if(cout[3]>0)
    {
    if((cout[3]!=128)) // 判断 cout【2】
    {
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[3]=(unsigned char)cout[3];
    }
    cout[3]=0;
    }
    }
    if((rcvcanbuf[k*10U+3U]==1))
    {
    cout[1]++;
    if(cout[2]>0)
    {
    if((cout[2]!=128)) // 判断 cout【2】
    {
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[2]=(unsigned char)cout[2];
    }
    cout[2]=0;
    }
    }
    if((rcvcanbuf[k*10U+3U]==3))
    {
    cout[3]++;
    if(cout[0]>0)
    {
    if((cout[0]!=128)) // 判断 cout【3】
    {
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[0]=(unsigned char)cout[0];
    }
    cout[0]=0;
    }
    }
    }
    else
    {
    CANRevNum=CANRevNum;
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[0]=0xFD;
    cout11[1]=0xFD;
    cout11[2]=0xFD;
    cout11[3]=0xFD;
    }

    if(CANRevFirst==0)
    {
    if(CANRevNum==0xFF)
    {
    if(rcvCan[i].data[0]!=0)
    {

    CANRevNum=CANRevNum;
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[0]=0xFC;
    cout11[1]=0xFC;
    cout11[2]=0xFC;
    cout11[3]=0xFC;
    }
    else
    {

    CANRevNum=CANRevNum;
    }
    }
    else
    {
    if(rcvCan[i].data[0]!=CANRevNum+1)
    {
    CANRevNum=CANRevNum;
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[0]=0xFB;
    cout11[1]=0xFB;
    cout11[2]=0xFB;
    cout11[3]=0xFB;
    }
    else
    {

    CANRevNum=CANRevNum;
    }

    }
    }

    if(CANRevFirst==1)
    CANRevFirst=0;
    CANRevNum = rcvCan[i].data[0];


    ////////////////////////////////////
    mem_cpy(&g_RcvCanbuf[g_RcvCanlen],&rcvcanbuf[k*10U],10U); /*拷贝要发送给从CPU的数据*/
    g_RcvCanlen = g_RcvCanlen+10U; /*要发送给从CPU的数据长度赋值*/

    i = i+1U;
    k = k+1U;
    }
    TotalLen = TotalLen+rcvlen;
    if(TotalLen>MAX_MODUS*10U*2U) /*超过最大数量的2倍认为接收异常*/
    {
    fatalErr=fERR_CanRcv;
    MyExit();
    break;
    }
    }while(rcvlen>0U);

    if((canrcverr==1U) && (i>0U)) /*CAN数据有错误时,清空接收长度*/
    {
    i=0U;
    g_RcvCanlen = 0U;
    canrcverr = 0U;
    }
    /*测试后添加,临时*/
    return i;
    }

    static void SendCAN(uint16_t paks)
    {
    uint8_t sndcanbuf[10*MAX_MODUS]={0U}; /*CAN收到的数据包数*/
    uint16_t j = 0U;
    uint16_t i = 0U;
    static uint32_t serr_cnt=0U; /*最后一次发送成功的时间,用于发送失败的判断*/

    if(serr_cnt==0U)
    {
    serr_cnt = tickGet();
    }

    while( (i<paks) && (i<(uint16_t)MAX_MODUS)) /*逐包发送CAN数据包*/
    {
    sndcanbuf[10U*i+0U]= (uint8_t)(sndCan[i].id>>3);
    sndcanbuf[10U*i+1U]= (uint8_t)(sndCan[i].id<<5) + 8U;
    for(j=0U;j<sndCan[i].dataLen;j++) /*发送CAN数据包中的8个字节*/
    {
    sndcanbuf[10U*i+j+2U]=sndCan[i].data[j];
    }
    i = i+1U;
    }
    if(CanSend(sndcanbuf, (uint32_t)paks) != (uint32_t)paks) /*判断 是否都发送完成*/
    {
    if(GetElapse(serr_cnt) >3000U) /* 3s 均发送失败则报错 */
    {
    OcuErr=ERR_CANSEND; /*20160518 gg*/
    }
    }
    else
    {
    serr_cnt=tickGet();
    }

    mem_set(sndCan,0U,sizeof(sndCan)); /*清空发送缓冲区*/
    }


    uint32_t CanInit(void)
    {
    /* enable irq interrupt in Cortex R4 */
    _enable_interrupt_();

    /** - writing a random data in RAM - to transmit */
    //dumpSomeData();

    /** - configuring CAN1 MB1,Msg ID-1 to transmit and CAN2 MB1 to receive */
    canInit();

    // canEnableStatusChangeNotification(canREG1);
    /** - enabling error interrupts */
    canEnableErrorNotification(canREG1);
    // canEnableErrorNotification(canREG2);

    return 1;
    }

    /* USER CODE BEGIN (2) */
    void canUpdateTRID(canBASE_t *node, uint32 messageBox, uint32 msgBoxArbitVal)
    {

    /** - Wait until IF1 is ready for use */
    while ((node->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */
    node->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U);
    node->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)(msgBoxArbitVal & (uint32)0x000007FFU) << (uint32)18U);
    node->IF1MCTL = 0x00001080U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)8U;
    node->IF1CMD = (uint8) 0xF8U;
    node->IF1NO = 1U;
    /** - Wait until data are copied into IF1 */
    while ((node->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */
    }
    /* USER CODE END */
    extern unsigned char cout11[4];
    uint32_t CanSend(uint8 *ptx,uint32 cnt)
    {
    uint32 rtn = 0U;
    uint32 success = 0U;
    static uint8_t flag = 0U;
    uint32 timecount=0;

    // success =cansendok(canREG1);

    /*while(tx_data_full==1); //该句话放在此处时,部分信号闪烁*/
    if((tx_data_full==0U)/*&&(cansendok(canREG1)*/)
    {
    tx_data_count = 0;
    mem_cpy(tx_data,ptx,cnt*10);
    uint32 msgBoxArbitVal = (((((uint32)tx_data[tx_data_count][0]))<<8)|((uint32)tx_data[tx_data_count][1]))>>5;
    canUpdateTRID(canREG1, canMESSAGE_BOX1, msgBoxArbitVal);//0x81 101
    success = canTransmit(canREG1, canMESSAGE_BOX1, &tx_data[tx_data_count][2]); /* transmitting 8 different chunks 1 by 1 */

    // RitDelay(1U);

    if(success!=1)
    {
    //(5U);


    //=tickGet();
    while((canTransmit(canREG1, canMESSAGE_BOX1, &tx_data[tx_data_count][2])!=1)&&(timecount<3))
    {
    if(timecount<8)
    timecount++;
    RitDelay(1);

    } // transmitting 8 different chunks 1 by 1
    timecount=0;
    // canUpdateTRID(canREG1, canMESSAGE_BOX9, msgBoxArbitVal);//0x81 101
    // success = canTransmit(canREG1, canMESSAGE_BOX9, &tx_data[tx_data_count][2]); /* transmitting 8 different chunks 1 by 1 */
    }

    if(success!=1)
    {
    success=0;
    hetio(21U,1U); //crc错误点红灯
    hetio(9U,1U);
    hetio(9U,0U);
    cout11[0]=0xFE;
    cout11[1]=0xFE;
    cout11[2]=0xFE;
    cout11[3]=0xFE;
    }

    // while(cansendfinish(canREG1)!=1)
    ;

    rtn = cnt;
    spakcnt = cnt;
    tx_data_full=1U;
    tx_data_count++;

    if(flag==0U)
    {
    flag = 1U;
    }
    else
    {
    flag = 0U;
    }
    hetio(26,flag);
    hetio(9,1);
    hetio(9,0);

    SetDebugSndData_CanSnd(ptx,cnt*10);
    }
    #ifdef DEBUG_ETHMOD
    // SetModData_CanSnd(ptx,cnt*10U);
    #endif

    /*while(tx_data_full==1 && success!=0);*/

    return rtn;
    }
    /*数据队列存储*/
    void PushStack1(uint8_t buf[])
    {
    if((stackHead1 == stackTail1) && (stackLen1 != 0U)) /*队列满之后一直走该分支*/
    {
    mem_cpy(&stackBuf1[stackTail1][0],buf,10U);
    stackTail1 = stackTail1 + 1U;
    if(stackTail1==MAX_MODUS*2)
    {
    stackTail1 = 0U;
    }
    stackHead1 = stackTail1;
    }
    else /*队列未满走该分支*/
    {
    mem_cpy(&stackBuf1[stackTail1][0],buf,10U);
    stackLen1 = stackLen1 + 1U;
    stackTail1 = stackTail1 + 1U;
    if(stackTail1==MAX_MODUS*2)
    {
    stackTail1 = 0U;
    }
    }
    tmp_RxCount++;
    }
    /*数据队列提取*/
    uint32_t PopStack1(uint8_t buf[])
    {
    uint32_t rtnlen = 0U;
    if(stackLen1==0U)
    {
    /* 无数据 */
    rtnlen = 0U;
    }
    else
    {
    mem_cpy(buf,&stackBuf1[stackHead1][0],10U);
    mem_set(&stackBuf1[stackHead1][0],0U,10U);
    stackHead1 = stackHead1 + 1U;
    if(stackHead1==MAX_MODUS*2)
    {
    stackHead1 = 0U;
    }
    stackLen1 = stackLen1 - 1U;

    rtnlen = 10U;
    }

    return rtnlen;
    }
    uint32_t CanRecive(uint8 *ptr,uint32 buflen)
    {
    static uint8_t flag = 0U;
    uint32_t cnt = 0U;
    uint8_t buf[10] = {0U};

    while(cnt<buflen)
    {
    if(PopStack1(buf)>0U)
    {
    mem_cpy(&ptr[cnt],buf,10U);
    cnt = cnt + 10U;
    }
    else
    {
    break;
    }
    }

    if(cnt>0U)
    {
    if(flag==0U)
    {
    flag = 1U;
    }
    else
    {
    flag = 0U;
    }
    hetio(27,flag);
    hetio(9,1);
    hetio(9,0);
    }


    #ifdef DEBUG_COM
    if((tmp_RxCount!=MAX_MODUS) && (cnt!=0))
    {
    SetDebugSndData_CanRcv(ptr,cnt);
    }
    if(tmp_RxCount>MAX_MODUS)
    {
    tmp_RxCount = 0;
    }
    tmp_RxCount = 0;
    #endif

    return cnt; /*返回接收成功的字节数*/

    if(rpakcnt>0U)
    {
    if(buflen>=rpakcnt*10)
    {
    disablecanint();
    mem_cpy(ptr,rx_ptr,rpakcnt*10);
    rx_data_count = 0U;
    cnt = rpakcnt*10;
    rpakcnt = 0U;
    enablecanint();
    }
    else
    {
    disablecanint();
    mem_cpy(ptr,rx_ptr,buflen);
    mem_cpy(rx_ptr,&rx_ptr[buflen],rpakcnt*10-buflen);
    rx_data_count = rpakcnt-buflen/10U;
    cnt = buflen;
    rpakcnt = rpakcnt-buflen/10U;
    enablecanint();
    }

    if(flag==0U)
    {
    flag = 1U;
    }
    else
    {
    flag = 0U;
    }
    hetio(27,flag);
    hetio(9,1);
    hetio(9,0);
    }
    else
    {
    cnt = 0U;
    }

    //SetDebugSndData_CanRcv(rx_ptr,cnt);

    return cnt;
    }

    /* USER CODE BEGIN (4) */
    void Delay(uint32 cout)
    {
    uint32 i;
    for(i=0;i<cout;i++)
    {
    i++;
    i--;
    }

    }

    /* can interrupt notification */
    /* Note-You need to remove canMessageNotification from notification.c to avoid redefinition */
    extern unsigned char sendok;
    void canMessageNotification(canBASE_t *node, uint32 messageBox)
    {
    uint32 success = 0;
    /* node 1 - transfer request */
    if(node==canREG1 && messageBox==canMESSAGE_BOX1)
    {
    /** - starting transmission */
    if(tx_data_count<spakcnt)
    {
    uint32 msgBoxArbitVal = (((((uint32)tx_data[tx_data_count][0]))<<8)|((uint32)tx_data[tx_data_count][1]))>>5;
    canUpdateTRID(canREG1, canMESSAGE_BOX1, msgBoxArbitVal);/*0x81 101*/
    if(canTransmit(canREG1, canMESSAGE_BOX1, &tx_data[tx_data_count][2])==1) /* transmitting 8 different chunks 1 by 1 */
    tx_data_count = tx_data_count+1U;

    if(tx_data_count<spakcnt)
    {
    if(tx_data_count%45==0)
    {
    // RitDelay(1U);
    Delay(0x2FFF);
    }
    }
    }
    else
    {
    tx_data_count=0U;
    tx_data_full=0U;
    }
    }
    /*
    if(node==canREG1 && messageBox==canMESSAGE_BOX9)
    {
    if(tx_data_count<spakcnt)
    {
    uint32 msgBoxArbitVal = (((((uint32)tx_data[tx_data_count][0]))<<8)|((uint32)tx_data[tx_data_count][1]))>>5;
    canUpdateTRID(canREG1, canMESSAGE_BOX9, msgBoxArbitVal);
    canTransmit(canREG1, canMESSAGE_BOX9, &tx_data[tx_data_count][2]);
    tx_data_count = tx_data_count+1U;

    if(tx_data_count<spakcnt)
    {
    if(tx_data_count%45==0)
    {
    // RitDelay(1U);
    Delay(0x2FFF);
    }
    }
    }
    else
    {
    tx_data_count=0U;
    tx_data_full=0U;
    }
    }
    */
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX2)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX2))
    {
    success= canGetData(canREG1, canMESSAGE_BOX2, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX3)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX3))
    {
    success= canGetData(canREG1, canMESSAGE_BOX3, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX4)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX4))
    {
    success= canGetData(canREG1, canMESSAGE_BOX4, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX5)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX5))
    {
    success= canGetData(canREG1, canMESSAGE_BOX5, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX6)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX6))
    {
    success= canGetData(canREG1, canMESSAGE_BOX6, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX7)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX7))
    {
    success= canGetData(canREG1, canMESSAGE_BOX7, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }

    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX8)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX8))
    {
    success= canGetData(canREG1, canMESSAGE_BOX8, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }
    }
    }
    /* node 2 - receive complete */
    if(node==canREG1 && messageBox==canMESSAGE_BOX10)
    {
    if(canIsRxMessageArrived(canREG1, canMESSAGE_BOX10))
    {
    success= canGetData(canREG1, canMESSAGE_BOX10, &rx_ptr[rx_data_count*10]); /* copy to RAM */
    if(success==1)
    {
    if(CANRevIntenable==1)
    PushStack1(rx_ptr);
    }

    }
    }
    /* Note: since only message box 1 is used on both nodes we dont check it here.*/


    }

    void canInit(void)
    {
    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    /** @b Initialize @b CAN1: */

    /** - Setup control register
    * - Disable automatic wakeup on bus activity
    * - Local power down mode disabled
    * - Disable DMA request lines
    * - Enable global Interrupt Line 0 and 1
    * - Disable debug mode
    * - Release from software reset
    * - Enable/Disable parity or ECC
    * - Enable/Disable auto bus on timer
    * - Setup message completion before entering debug state
    * - Setup normal operation mode
    * - Request write access to the configuration registers
    * - Setup automatic retransmission of messages
    * - Disable error interrupts
    * - Disable status interrupts
    * - Enter initialization mode
    */
    canREG1->CTL = (uint32)0x00000200U
    | (uint32)0x00000000U
    | (uint32)((uint32)0x0000000AU << 10U)
    | (uint32)0x00020043U;

    /** - Clear all pending error flags and reset current status */
    canREG1->ES |= 0xFFFFFFFFU;

    /** - Assign interrupt level for messages */
    canREG1->INTMUXx[0U] = (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U;

    canREG1->INTMUXx[1U] = (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U
    | (uint32)0x00000000U;

    /** - Setup auto bus on timer period */
    canREG1->ABOTR = (uint32)0U;

    /** - Initialize message 1
    * - Wait until IF1 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF1 control byte
    * - Set IF1 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */


    canREG1->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)1U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1MCTL = 0x00001080U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF1CMD = (uint8) 0xF8U;
    canREG1->IF1NO = 1U;

    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 2U;

    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x8U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 3U;

    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x10U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 4U;
    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x18U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 5U;
    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x20U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 6U;
    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x28U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 7U;
    /** - Initialize message 2
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)2U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x30U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 8U;
    /** - Initialize message 9
    * - Wait until IF1 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF1 control byte
    * - Set IF1 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */
    /*
    canREG1->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)1U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1MCTL = 0x00001080U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF1CMD = (uint8) 0xF8U;
    canREG1->IF1NO = 1U;
    */

    canREG1->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x1U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF1MCTL = 0x00001080U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF1CMD = (uint8) 0xF8U;
    canREG1->IF1NO = 9U;

    /** - Initialize message 10
    * - Wait until IF2 is ready for use
    * - Set message mask
    * - Set message control word
    * - Set message arbitration
    * - Set IF2 control byte
    * - Set IF2 message number
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    // canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32) 0x00000000U & (uint32)0x000007FFU) << (uint32)18U);
    // canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x85U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x38U & (uint32)0x000007FFU) << (uint32)18U);
    canREG1->IF2MCTL = 0x00001080U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)8U;
    canREG1->IF2CMD = (uint8) 0xF8U;
    canREG1->IF2NO = 10U;

    /** - Setup IF1 for data transmission
    * - Wait until IF1 is ready for use
    * - Set IF1 control byte
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */
    canREG1->IF1CMD = 0x87U;

    /** - Setup IF2 for reading data
    * - Wait until IF1 is ready for use
    * - Set IF1 control byte
    */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((canREG1->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */
    canREG1->IF2CMD = 0x17U;

    /** - Setup bit timing
    * - Setup baud rate prescaler extension
    * - Setup TSeg2
    * - Setup TSeg1
    * - Setup sample jump width
    * - Setup baud rate prescaler
    */
    canREG1->BTR = (uint32)((uint32)0U << 16U) |
    (uint32)((uint32)(4U - 1U) << 12U) |
    (uint32)((uint32)((2U + 4U) - 1U) << 8U) |
    (uint32)((uint32)(4U - 1U) << 6U) |
    (uint32)39U;


    /** - CAN1 Port output values */
    canREG1->TIOC = (uint32)((uint32)1U << 18U )
    | (uint32)((uint32)0U << 17U )
    | (uint32)((uint32)0U << 16U )
    | (uint32)((uint32)1U << 3U )
    | (uint32)((uint32)1U << 2U )
    | (uint32)((uint32)1U << 1U );

    canREG1->RIOC = (uint32)((uint32)1U << 18U )
    | (uint32)((uint32)0U << 17U )
    | (uint32)((uint32)0U << 16U )
    | (uint32)((uint32)1U << 3U )
    | (uint32)((uint32)0U << 2U )
    | (uint32)((uint32)0U <<1U );

    /** - Leave configuration and initialization mode */
    canREG1->CTL &= ~(uint32)(0x00000041U);


    /** @note This function has to be called before the driver can be used.\n
    * This function has to be executed in privileged mode.\n
    */

    /* USER CODE BEGIN (5) */
    /* USER CODE END */
    }

    uint32 canTransmit(canBASE_t *node, uint32 messageBox, const uint8 * data)
    {
    uint32 i;
    uint32 success = 0U;
    uint32 regIndex = (messageBox - 1U) >> 5U;
    uint32 bitIndex = 1U << ((messageBox - 1U) & 0x1FU);

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


    /** - Check for pending message:
    * - pending message, return 0
    * - no pending message, start new transmission
    */

    if ((node->TXRQx[regIndex] & bitIndex) != 0U)
    {
    success = 0U;
    }

    else
    {
    /** - Wait until IF1 is ready for use */
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
    while ((node->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    /** - Configure IF1 for
    * - Message direction - Write
    * - Data Update
    * - Start Transmission
    */
    node->IF1CMD = 0x87U;

    /** - Copy TX data into IF1 */
    for (i = 0U; i < 8U; i++)
    {
    #if ((__little_endian__ == 1) || (__LITTLE_ENDIAN__ == 1))
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    node->IF1DATx[i] = *data;
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
    data++;
    #else
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    node->IF1DATx[s_canByteOrder[i]] = *data;
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
    data++;
    #endif
    }

    /** - Copy TX data into message box */
    /*SAFETYMCUSW 93 S MR: 6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "LDRA Tool issue" */
    node->IF1NO = (uint8) messageBox;

    success = 1U;
    }
    /** @note The function canInit has to be called before this function can be used.\n
    * The user is responsible to initialize the message box.
    */

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

    return success;
    }

    void canUpdateID(canBASE_t *node, uint32 messageBox, uint32 msgBoxArbitVal)
    {

    /** - Wait until IF2 is ready for use */
    while ((node->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    /** - Configure IF2 for
    * - Message direction - Read
    * - Data Read
    * - Clears NewDat bit in the message object.
    */
    node->IF2CMD = 0xA0U;
    /* Copy passed value into the arbitration register. */
    node->IF2ARB &= 0x80000000U;
    node->IF2ARB |= (msgBoxArbitVal & 0x7FFFFFFFU);

    /** - Update message box number. */
    /*SAFETYMCUSW 93 S MR: 6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "LDRA Tool issue" */
    node->IF2NO = (uint8) messageBox;

    /** - Wait until data are copied into IF2 */
    while ((node->IF2STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    }

    uint32 canIsTxMessagePending(canBASE_t *node, uint32 messageBox)
    {
    uint32 flag;
    uint32 regIndex = (messageBox - 1U) >> 5U;
    uint32 bitIndex = 1U << ((messageBox - 1U) & 0x1FU);

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

    /** - Read Tx request register */
    flag = node->TXRQx[regIndex] & bitIndex;

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

    return flag;
    }

    unsigned int cansendfinish(canBASE_t *node)
    {
    unsigned int temp=0;
    temp= node->ES & 0xFFFU;
    return temp;
    }


    void enablecanint(void)
    {
    /*
    canREG1->CTL = canREG1->CTL | 0x0E;
    canREG1->IF1MCTL=canREG1->IF1MCTL | 0xB00;
    canREG1->IF2MCTL=canREG1->IF2MCTL | 0xB00;
    canREG1->IF3MCTL=canREG1->IF3MCTL | 0xB00;
    */
    CANRevIntenable=1;
    }

    void disablecanint(void)
    {
    /*
    canREG1->CTL = canREG1->CTL & 0xFFFFFFF1;
    canREG1->IF1MCTL=canREG1->IF1MCTL & 0xFFFFF4FF;
    canREG1->IF2MCTL=canREG1->IF2MCTL & 0xFFFFF4FF;
    canREG1->IF3MCTL=canREG1->IF3MCTL & 0xFFFFF4FF;
    */
    CANRevIntenable=0;
    }

  • how to use canIsTxMessagePending(),should i check this flag before use uint32 canTransmit(canBASE_t *node, uint32 messageBox, const uint8 * data)?if canIsTxMessagePending()is 1 that if message is pending ,what should i do, wait a time, for example 5ms ?

  • how to use canIsTxMessagePending(),should i check this flag before use uint32 canTransmit(canBASE_t *node, uint32 messageBox, const uint8 * data)?if canIsTxMessagePending()is 1 that if message is pending ,what should i do, wait a time, for example 5ms ?
  • Hello,
    Please take a look at example in HALCoGen - canIntCommunication.c
    You could find this example under HALCoGen example folder and description is in HALCoGen Help Topics.

    Best regards,
    Miro