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.

Help CAN transmit function selecting and configuring the mailbox

Other Parts Discussed in Thread: TMS320F28335

Hi all....

I am using TMS320F28335 and I am trying to write some functions to transmit data using the CAN interface in which would be possible to select the mailbox to use in the transmission.

The idea is to pass the Mailbox number as a parameter of the function and then set up the corresponding mailbox inside. with use of switch() I have to set up  ECanaMboxes and ECanaRegs structures for each of them separately that results in huge amount of code. Because every time to transmit or receive messages mailbox configuration is same, only difference is mailbox number, MSGID and data.

Is there any example code in which use of multiple mailboxes as a same time with kind of configuration function??

Any suggestion would be great help.

Thanks in advance

Mehul

  • Check the eCAN sample project, example available for mailbox read

    void mailbox_read(int16 MBXnbr)
    {
    volatile struct MBOX *Mailbox;
    Mailbox = &ECanaMboxes.MBOX0 + MBXnbr;

    I assume same method you can use for transmit also.

  • Hello Joy,

    thank you for reply.

    I already seen this example but thing is that there is need to set different registers like CANMD, CANME, CANTRS which are related with mailbox number.

    so with particular mailbox number how can I configure this all registers by parameters of functions??

    Mehul 

  • Hi.

    I suggest you to take a look at this presentation:

       http://www.slideshare.net/pantechsolutions/can-f28x

    mehul thummar said:
    so with particular mailbox number how can I configure this all registers by parameters of functions??

    First of all, you should configure CAN RX/TX pins,  enable CAN clock, configure CAN bus and then configure MBOXes with it appropriate function.

    CANME designed to enable/disable corresponding MBOX. CANMD selects MBOX functions from sender and receiver. CANTRS used to ask CAN kernel to transmit contents of MBOX. CANTA used to check transmission status and so on. As an additional example, check this.