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.

TMS570LS0432: TMS570LS0432 How to modify CANBUS id to receive on mailbox2.

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN

Hi,

I used the CANBUS sample code on TMS570LS0432.

I have a question for CANBUS modify id.

When the CAN transmit data length over 8 bits.

I should  modify CAN id,that can put the back data in next mailbox2.

Could you tell me how to do that.

  • Hi Kuanlei,

    CAN Protocol is limited to a maximum payload of 8 bytes. You will not be able to send a payload of greater than 8 bytes in one frame. If you have more than 8 bytes, you can transmit the remaining bytes in 2nd, 3rd, .. frames. You don't need to use another mailbox.

  • Hi, QJ Wang

    Thank you reply!

    Did you mean if I have 16 bytes CAN data,I only need 1 RX mailbox to receive, and use 1 TX mailbox to send the data twice?

    Could you have any sample code to teach me?

    I think,I have to use canUpdateID( ) function to do right? But I don't have any idea how to do.

  • If you have 16 bytes to transmit, canTransmit() should be called twice:

    D_COUNT = 2;

    uint8 tx_data[D_COUNT][8] = {... ...};

    uint8 *tx_ptr = &tx_data[0][0];

    /** - starting transmission */
    for(cnt=0;cnt<D_COUNT;cnt++)
    {
         canTransmit(canREG1, canMESSAGE_BOX1, tx_ptr); /* transmitting 8 different chunks 1 by 1 */
         while(tx_done == 0){}; /* ... wait until transmit request is through */
         tx_done=0;
         tx_ptr +=8; /* next 8 bytes ...*/
    }

    Please see the example in HALCOGen: example_canIntCommunication.c

    If you want to transmit a message with different message ID, you need to call canUpdateID() fist, then call  canTransmit().