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.

TMS320C28346: TMS320C28346 ECAN use problem

Part Number: TMS320C28346
Other Parts Discussed in Thread: TMS320F28335

Hi,

   when I use the  official referral program:ecan_a_to_b_xmit ; I find the program will end in this while task,

however , if I don't  use this while and  set "ECanaRegs.CANTRS.all " directly,  I can receive  the data from my computer by a CAN receiver.

below is my hardware design for ECAN:

so, my question is why I can't  get the Transmission-Acknowledge ? 

  •  when I use the  official referral program:ecan_a_to_b_xmit ; I find the program will end in this while task,

    You mean it is looping forever in this loop? One thing I noticed in your code snippet:

    while(ECanbaShadow.CANTA.bit.TA25 == 0 );

    It should either be ECanaShadow or ECanbShadow. It cannot be ECanbaShadow. I wonder how your code even compiled with this error. 

    if I don't  use this while and  set "ECanaRegs.CANTRS.all " directly, 

    I don't understand what you are trying to say here. You can only set TRSn bit to initiate transmission. After the transmission is complete, this bit is automatically cleared by the CAN module. You cannot clear it manually. 

    why I can't  get the Transmission-Acknowledge ? 

    Please download my Application report http://www.ti.com/lit/spra876. It has many tested examples. Note that the examples were written for the TMS320F28335 device. However, they can be easily adopted for any 28x device with eCAN, provided you take care of the change in SYSCLKOUT speed and the resultant changes warranted for the CANBTC register. I request you to look at the Debug tips provided. Most CAN issues can be resolved by going through this checklist. Specifically, I have explained the ACK mechanism in detail.

  • Thank you for your reply , I'm sorry that I uploaded wrong  codes, here is the right code:

    It is  looping forever in this while loop, if I use the next codes and don't wait for the while task:

    then I can receive  the data from my computer by a CAN receiver. But now I need to know when one ECAN transmission is done.

    what's the difference with them(all the initial set of ECAN are same), why the fficial referral program can't succeed  in my hardware?

  • Please run CAN_TXLOOP_A from SPRA876 and let me now what you observe. It is a tested code and should work "as is". The only change you need to make is to the CANBTR register to account for the different SYSCLKOUT frequency of C28346.

  • Hello,the result of  CAN_TXLOOP_A from SPRA876  is same with ecan_a_to_b_xmit  project. Both of them end in the while above. That's strange,  I want to know if there are some mistakes with my hardware?

  • If the example from SPRA876 itself does not work, it is likely there is some hardware issue.

  • but my hardware can transmit data if I don't use the while, as is saying above,and the hardware is above also.

  • Please copy CANTA into ECanaShadow.CANTA before you start executing the do-while loop:

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

    If that doesn't help, I really don't know what the issue could be. You are saying the tested code from SPRA876 also shows the same issue, but you are able to get your transmission to to work if you don't poll TA0.