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/TMS570LS1227: CANnetwok. Can't change messages ID

Part Number: TMS570LS1227

Tool/software: Code Composer Studio

My board must receive messages in canGER2 and transmit it from canGER1. canREG2 getting mesages with IDs from 0x600 to 0x6FF. I can get all range in one messageBox but transmit can't becouse settings of message boxes are set during configuration.

I triy do like this

void canMessageNotification(canBASE_t *node, uint32 messageBox)
{
     if(messageBox == canMESSAGE_BOX3)
     {
          while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX3));
          canGetData(canREG2, canMESSAGE_BOX3, rx_data);
          ID_Value = (canGetID(canREG2, canMESSAGE_BOX3) >> (uint32)18U);
          canUpdateID(canREG1, canMESSAGE_BOX17, ID_Value);
          canTransmit(canREG1, canMESSAGE_BOX17, rx_data);
     }

}

(accept messages with ID from 0x600 to 0x6FF). I extract ID, and triy to update ID of message_box_17 canREG1 for what message from camREG1. When I looked in can.c file I found that canUpdateID function uising IF2 register and canTransmit function uisng IF1 register. It follows that I can't use canUpdateID to make changes transmiting function? Why this funtions useing differnt registers?

I changing canUpdateID function like this

void canUpdate_ID(canBASE_t *node, uint32 messageBox, uint32 msgBoxArbitVal)
{
     while ((node->IF1STAT & 0x80U) ==0x80U)
     {
     } /* Wait */

     node->IF1CMD = 0xA0U;

     node->IF1ARB &= 0x80000000U;
     node->IF1ARB |= (msgBoxArbitVal & 0x7FFFFFFFU);

     node->IF1NO = (uint8) messageBox;

     while ((node->IF1STAT & 0x80U) ==0x80U)
     {
     } /* Wait */
}

And use canUpdate_ID(canBASE_t *node, uint32 messageBox, uint32 msgBoxArbitVal). And it doesn't work, too!

I tring anothe way...

if(messageBox==canMESSAGE_BOX3)
{
     while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX3));
     canGetData(canREG2, canMESSAGE_BOX3, rx_data);
     ID_Value = (canGetID(canREG2, canMESSAGE_BOX3) >> (uint32)18U);

     canREG1->IF1CMD = 0xA0U;
     canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)ID_Value & (uint32)0x000007FFU) << (uint32)18U);
     canTransmit(canREG1, canMESSAGE_BOX17, rx_data);
}

And form all range of IDs retransmition only 0x600.

How can I arrange for correct message forwarding?