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.

problem in eCan_a_to_b_xmit in TMS320F28335

Hellow :

   I am trying to send and receive the message with two boards of 28335, when I run the example it stay in the loop, two board with the same Bit rate(BRPREG = 99; TSEG2= 2; TSEG1 = 10;), and I can see the signal from the oscilloscope, I don t know why the Bit TA is not setting.

   

for(i=0; i < TXCOUNT; i++)
   {
       ECanaShadow.CANTRS.all = 0;
       ECanaShadow.CANTRS.bit.TRS25 = 1;             // Set TRS for mailbox under test
       ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;

       do
     {
       ECanaShadow.CANTA.all = ECanaRegs.CANTA.all;
    
     } while(ECanaShadow.CANTA.bit.TA25 == 0 );   // Wait for TA25 bit to be set..


       ECanaShadow.CANTA.all = 0;
       ECanaShadow.CANTA.bit.TA25 = 1;               // Clear TA25
       ECanaRegs.CANTA.all = ECanaShadow.CANTA.all;

       loopcount ++;
    }

  Can some one help me,please?

  • If you use two boards and the CAN is correctly connected and both devices are properly initialized and running, then the 2nd node will acknowledge the message transmitted by node 1. In that case ACK goes low, and your transmitting node will see TA=1. If the 2nd node is not initialized and running, the ACK will be missing and node 1 will be trapped in the TA-loop, as in your problem description.

      

  • thanks for your answer, I also think so, but I can t find any problem in my receiving program, could you help me check a little if you have time, the program as follows:

      InitECan();

    /* Write to the MSGID field */

    ECanbMboxes.MBOX0.MSGID.all = 0x00000001; // Extended Identifier
    ECanbMboxes.MBOX1.MSGID.all = 0x00000002;
    ECanbMboxes.MBOX2.MSGID.all = 0x00000003;
    ECanbMboxes.MBOX3.MSGID.all = 0x00000004;
    ECanbMboxes.MBOX4.MSGID.all = 0x00000005;
    ECanbMboxes.MBOX5.MSGID.all = 0x00000006;
    ECanbMboxes.MBOX6.MSGID.all = 0x00000007;
    ECanbMboxes.MBOX7.MSGID.all = 0x00000008;
    ECanbMboxes.MBOX8.MSGID.all = 0x00000009;
    ECanbMboxes.MBOX9.MSGID.all = 0x00000010;
    ECanbMboxes.MBOX10.MSGID.all = 0x00000011;
    ECanbMboxes.MBOX11.MSGID.all = 0x00000012;
    ECanbMboxes.MBOX12.MSGID.all = 0x00000013;
    ECanbMboxes.MBOX13.MSGID.all = 0x00000014;
    ECanbMboxes.MBOX14.MSGID.all = 0x00000015;
    ECanbMboxes.MBOX15.MSGID.all = 0x00000016;
    ECanbMboxes.MBOX16.MSGID.all = 0x00000017;
    ECanbMboxes.MBOX17.MSGID.all = 0x00000018;
    ECanbMboxes.MBOX18.MSGID.all = 0x00000019;
    ECanbMboxes.MBOX19.MSGID.all = 0x00000020;
    ECanbMboxes.MBOX20.MSGID.all = 0x00000021;
    ECanbMboxes.MBOX21.MSGID.all = 0x00000022;
    ECanbMboxes.MBOX22.MSGID.all = 0x00000023;
    ECanbMboxes.MBOX23.MSGID.all = 0x00000024;
    ECanbMboxes.MBOX24.MSGID.all = 0x00000025;
    ECanbMboxes.MBOX25.MSGID.all = 0x95555555;
    ECanbMboxes.MBOX26.MSGID.all = 0x00000027;
    ECanbMboxes.MBOX27.MSGID.all = 0x00000028;
    ECanbMboxes.MBOX28.MSGID.all = 0x00000029;
    ECanbMboxes.MBOX29.MSGID.all = 0x00000030;
    ECanbMboxes.MBOX30.MSGID.all = 0x00000031;
    ECanbMboxes.MBOX31.MSGID.all = 0x00000032;
    /* 2 Configure Mailbox under test as a Receive mailbox */

    ECanbShadow.CANMD.all = ECanbRegs.CANMD.all;
    ECanbShadow.CANMD.all = 0xFFFFFFFF;
    ECanbRegs.CANMD.all = ECanbShadow.CANMD.all;

    /* Enable Mailbox under test */

    ECanbShadow.CANME.all = ECanbRegs.CANME.all;
    ECanbShadow.CANME.all = 0xFFFFFFFF;
    ECanbRegs.CANME.all = ECanbShadow.CANME.all;

    /* Begin receiving */
    while(1)
    {
    while(ECanbRegs.CANRMP.all != 0xFFFFFFFF ){}
    // ECanaShadow.CANRMP.all !=1;
    ECanbRegs.CANRMP.all = 0xFFFFFFFF;
    RXCOUNT++;
    }

    }

    by the way, is it that the 2nd CAN node need not be configured to receive the message, it just need to be configured for same bit rate?

  • The 2nd node does not have to be configured to receive the message, it just needs to be configured to the same data rate - and it must run!

    Your code looks weird:

    ECanbMboxes.MBOX0.MSGID.all = 0x00000001; // Extended Identifier  ==> This is NOT an extended Identifier, see user guide

    If your other node sends extended identifiers, you will never receive anything.

     

  • thanks for your reply, Frank :

      I know it will receive any things for the mailbox1 to the mailbox24, I just want to know what's the influence of the mailbox ID, but for the mailbox 25 I use the same ID with the sending mailbox ID, and the result is : it still can't receive any message, I don't know why? if the program is correct,  may be it as you said, the 2nd board doesn't running the program at all.  I will check it again.

     and other question is the 2nd board use the GPIO16 for CANTXB and GPIO17 for CANRXB, so I must use the eCAN-B instead of eCAN-A ?

    thanks.

  • I found the reason, but i don t know why, When I delete DELAY_US(3L);it s worked, that is strange.

  • I have met the same problem, but can't solve it.

    And , which file contains this "DELAY_US(3L)"

    Can u help me? My email is rb_cat@hotmail.com

    Thanks very much.