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.

TMS320F28335: Controller having problem in CAN reception

Part Number: TMS320F28335

1. I am facing problem in CANB reception in 1 of 150 controllers used. Transmission is proper.

2. Earlier I have faced problem in 1 of the controller during CANB configuration, controller was getting hanged. Changing the device had solved the problem.

Is there any problem with the device? 

  • Hi Akshay,

    Are you getting a receive interrupt?
    Did you check the Transmit Message RAM?

    Thanks and Regards
    Harshmeet
  • Hi Harshmeet,

    Thank you for the immediate response.

    I am not getting receive interrupt.
    No issue with the transmission.

    Regards,
    Akshay
  • Hi Akshay,

    A few more questions:
    1. Is the transmit message RAM is configured properly? What do you see on the transmit side?
    2. Are the interrupts enabled?
    3. Is there a CAN Transceiver?

    Regards
    Harshmeet
  • Hi Harshmeet,

    1. I guess it is configured properly since the code is working in other 100 controllers. Do you suggest me to look into any specific configuration?
    2. Yes the interrupts are enabled.
    3. Yes there is a CAN Transceiver and I have tried changing that device.

    Thanks and Regards,
    Akshay
  • Hi Harshmeet,

    Do you need anymore information to look into the problem?

    Thanks and Regards,
    Akshay
  • Akshay,

    From your reply above i understood that the code is not working on one controller and is working on the rest 100.
    So there is nothing incorrect in configuration. Am i correct?

    So i think there is something to do with device.

    Thanks and Regards
    Harshmeet
  • Harshmeet,

    Yes, in one controller we found that
    1. controller is getting hanged during CANB configuration and in other 2. receive interrupt is not hitting.
    We changed the controller for problem 1 and it was solved so the controller was misbehaving.

    I have not changed the controller for problem 2, since I was waiting for your feedback.

    Is there any issue with the controller CANB or problem in this particular batch?
    Has anybody reported similar problem?


    Regards,
    Akshay
  • Akshay,

    When you say the controller gets hanged during CANB Configuration. What do imply by that?

    No, there has been no issue that i remember.

    Regards
    Harshmeet
  • Harshmeet,

    After execution of one of the configuration instruction (loading values in the configuration registers) the controller was not executing the further instructions.
    That was a controller issue, after changing the controller the problem was solved.

    Regards,
    Akshay
  • Harshmeet,

    What do you suggest I should do?
    Shall I check by changing the controller or you suggest modification of the configuration?

    Regards,
    Akshay
  • Akshay,

    I am unable to understand. Is the same code working on a different controller and not on this one?

    Yes maybe you can try changing the controller if the code is same otherwise check the message RAM and where is it getting stuck?

    Regards
    Harshmeet
  • Harshmeet,

    Exactly, the same code working on a different controller and not on this one.
    My concern is the problem should not be repeating in multiple devices.
    If the problem is inherent in the controller we have to change the device and we need to know it now. 

    If it is a batch issue then we have to change the batch. 

    Can you tell me which batch of TMS320F28335PGFA are having problem?


    Regards,
    Akshay

  • No Akshay i have not heard of any such issue.

    You can try replacing the controller once.

    Regards
    Harshmeet
  • Were you able to find a solution?

    Regards
    Harshmeet
  • void configure_ECANb_module(void)
    {
    	InitECanbGpio();
    	EALLOW;
    	PieVectTable.ECAN0INTB = &ECANb_mailbox_isr;
    	PieVectTable.ECAN1INTB = &ECANb_system_isr;
    	EDIS;
    	struct ECAN_REGS ECanbShadow;
    	EALLOW;
    	ECanbShadow.CANTIOC.all = ECanbRegs.CANTIOC.all;
    	ECanbShadow.CANTIOC.bit.TXFUNC = 1;
    	ECanbRegs.CANTIOC.all = ECanbShadow.CANTIOC.all;
    	ECanbShadow.CANRIOC.all = ECanbRegs.CANRIOC.all;
    	ECanbShadow.CANRIOC.bit.RXFUNC = 1;
    	ECanbRegs.CANRIOC.all = ECanbShadow.CANRIOC.all;
    	ECanbShadow.CANMC.all = ECanbRegs.CANMC.all;
    	ECanbShadow.CANMC.bit.CCR = 1 ;
    	ECanbRegs.CANMC.all = ECanbShadow.CANMC.all;
    	ECanbShadow.CANES.all = ECanbRegs.CANES.all;
    	do
    	{
    		ECanbShadow.CANES.all = ECanbRegs.CANES.all;
    	} while(ECanbShadow.CANES.bit.CCE != 1 );
    	ECanbShadow.CANBTC.all = 0;
    	ECanbShadow.CANBTC.bit.BRPREG   = 19;
    	ECanbShadow.CANBTC.bit.TSEG2REG = 2;
    	ECanbShadow.CANBTC.bit.TSEG1REG = 10;
    	ECanbShadow.CANBTC.bit.SAM = 1;
    	ECanbRegs.CANBTC.all = ECanbShadow.CANBTC.all;
    	ECanbShadow.CANMC.all = ECanbRegs.CANMC.all;
    	ECanbShadow.CANMC.bit.SCB = 1;
    	ECanbRegs.CANMC.all = ECanbShadow.CANMC.all;
    	ECanbShadow.CANMC.all = ECanbRegs.CANMC.all;
    	ECanbShadow.CANMC.bit.MBNR= 0;
    	ECanbRegs.CANMC.all = ECanbShadow.CANMC.all;
    	ECanbShadow.CANMC.all = ECanbRegs.CANMC.all;
    	ECanbShadow.CANMC.bit.ABO = 1;
    	ECanbShadow.CANMC.bit.SUSP= 1;
    	ECanbRegs.CANMC.all = ECanbShadow.CANMC.all;
    	ECanbShadow.CANMIM.all = ECanbRegs.CANMIM.all;
    	ECanbShadow.CANMIM.all = 0xFFFFFFFF;
    	ECanbRegs.CANMIM.all   = ECanbShadow.CANMIM.all;
    	ECanbShadow.CANMIL.all = ECanbRegs.CANMIL.all;
    	ECanbShadow.CANMIL.all = 0x000000000;
    	ECanbRegs.CANMIL.all   = ECanbShadow.CANMIL.all;
    	ECanbShadow.CANGIM.all = ECanbRegs.CANGAM.all;
    	ECanbShadow.CANGIM.all = 0x00007E07;
    	ECanbRegs.CANGIM.all   = ECanbShadow.CANGIM.all;
    	ECanbMboxes.MBOX0.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX1.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX2.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX3.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX4.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX5.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX6.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX7.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX8.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX9.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX10.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX11.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX12.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX13.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX14.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX15.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX16.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX17.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX18.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX19.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX20.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX21.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX22.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX23.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX24.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX25.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX26.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX27.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX28.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX29.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX30.MSGCTRL.all = 0x00000000;
    	ECanbMboxes.MBOX31.MSGCTRL.all = 0x00000000;
    	ECanbShadow.CANMC.all = ECanbRegs.CANMC.all;
    	ECanbShadow.CANMC.bit.CCR = 0 ;
    	ECanbRegs.CANMC.all = ECanbShadow.CANMC.all;
    	do
    	{
    		ECanbShadow.CANES.all = ECanbRegs.CANES.all;
    	} while(ECanbShadow.CANES.bit.CCE != 0);
    	EDIS;
    	PieCtrlRegs.PIEIER9.bit.INTx7 = 1;
    	PieCtrlRegs.PIEIER9.bit.INTx8 = 1;
    	IER |= M_INT9;
    }
    
    void configure_ecanb_rx_mailbox(void)
    {
    
    	ECanbShadow.CANME.all = ECanbRegs.CANME.all;
    	ECanbRegs.CANME.bit.ME0= 0;
    	ECanbRegs.CANME.all = ECanbShadow.CANME.all;
    
    	ECanbMboxes.MBOX0.MSGID.all =0x0000ff00;
    	ECanbMboxes.MBOX1.MSGID.all =0x0000ff00;
    	ECanbMboxes.MBOX2.MSGID.all =0x0000ff00;
    	ECanbMboxes.MBOX3.MSGID.all =0x0000ff00;
    	ECanbMboxes.MBOX4.MSGID.all =0x0000ff00;
    	ECanbMboxes.MBOX5.MSGID.all =0x00000300;
    	ECanbMboxes.MBOX6.MSGID.all =0x00000300;
    	ECanbMboxes.MBOX7.MSGID.all =0x00000000;
    
    	ECanbMboxes.MBOX0.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX1.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX2.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX3.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX4.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX5.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX6.MSGID.bit.IDE=1;
    	ECanbMboxes.MBOX7.MSGID.bit.IDE=1;
    
    	ECanbMboxes.MBOX0.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX1.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX2.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX3.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX4.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX5.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX6.MSGID.bit.AME=1;
    	ECanbMboxes.MBOX7.MSGID.bit.AME=1;
    
    	ECanbLAMRegs.LAM0.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM1.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM2.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM3.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM4.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM5.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM6.all = 0x1FFF00FF;
    	ECanbLAMRegs.LAM7.all = 0x1FFFFFFF;
    
    	ECanbShadow.CANMD.all = ECanbRegs.CANMD.all;
    	ECanbShadow.CANMD.all |= 0xFF;
    	ECanbRegs.CANMD.all = ECanbShadow.CANMD.all;
    
    	ECanbShadow.CANOPC.all = ECanbRegs.CANOPC.all;
    	ECanbRegs.CANOPC.bit.OPC7 = 1;
    	ECanbRegs.CANOPC.all = ECanbShadow.CANOPC.all;
    
    	ECanbShadow.CANME.all = ECanbRegs.CANME.all;
    	ECanbShadow.CANME.all|= 0x0FF;
    	ECanbRegs.CANME.all = ECanbShadow.CANME.all;
    }
    
    void ecanb_mailbox_read(int16 ecan_b_MBXnbr)
    {
    	ecanb_Mailbox = &ECanbMboxes.MBOX0 + ecan_b_MBXnbr;
    	ecanb_Rx_DLC  = (ecanb_Mailbox->MSGCTRL.all & 0x0F);
    
    	ecanb_rcvd_address.rcv_byte.ecanb_lsb_byte = ecanb_Mailbox->MDL.all;
    	ecanb_rcvd_address.rcv_byte.ecanb_msb_byte = ecanb_Mailbox->MDH.all;
    	ecanb_message_identifier.all = (ecanb_Mailbox->MSGID.all & 0x1fffffff);
    	ecanb_rxpgn.bit.ecanb_reserved = 0;
    	ecanb_rxpgn.bit.ecanb_extended_datapage = ecanb_message_identifier.bit.ecanb_extended_datapage;
    	ecanb_rxpgn.bit.ecanb_data_page_bit = ecanb_message_identifier.bit.ecanb_data_page;
    	ecanb_rxpgn.bit.ecanb_pdu_format = ecanb_message_identifier.bit.ecanb_pdu_format_pf;
    
    	ecanb_rxpgn.bit.ecanb_group_extension = ecanb_message_identifier.bit.ecanb_pdu_specific;
    }
    
    void get_complete_id_ecanb(Uint32 dsp_pgn_no,Uchar8 dsp_priority,Uchar8 dsp_source_add)
    {
    	ecanb_txpgn.all = dsp_pgn_no;
    	ecanb_completeidentifier.bit.ecanb_reserved 		 = 0;
    	ecanb_completeidentifier.bit.ecanb_priority 		 = dsp_priority;
    	ecanb_completeidentifier.bit.ecanb_extended_datapage = ecanb_txpgn.bit.ecanb_extended_datapage;
    	ecanb_completeidentifier.bit.ecanb_data_page 		 = ecanb_txpgn.bit.ecanb_data_page_bit;
    	ecanb_completeidentifier.bit.ecanb_pdu_format_pf 	 = ecanb_txpgn.bit.ecanb_pdu_format;
    	ecanb_completeidentifier.bit.ecanb_pdu_specific 	= ecanb_txpgn.bit.ecanb_group_extension;
    	ecanb_completeidentifier.bit.ecanb_source_address 	= dsp_source_add;
    }
    
    void ECANb_tansmit_message(Uint32 dsp_id_29_bit,Uchar8 dsp_dlc_code,Uint64 dsp_data_ptr)
    {
    	ecanb_addressing.all = dsp_data_ptr;
    	ECanbShadow.CANME.all 		 = ECanbRegs.CANME.all;
    	ECanbShadow.CANME.bit.ME11  = 0;
    	ECanbRegs.CANME.all         = ECanbShadow.CANME.all;
    	ECanbMboxes.MBOX11.MSGID.all = dsp_id_29_bit;
    	ECanbMboxes.MBOX11.MSGID.bit.IDE = 1;
    	ECanbMboxes.MBOX11.MSGCTRL.bit.RTR = 0;
    	ECanbMboxes.MBOX11.MSGCTRL.bit.DLC = dsp_dlc_code;
    	ECanbShadow.CANMD.all 		= ECanbRegs.CANMD.all;
    	ECanbShadow.CANMD.bit.MD11 = 0;
    	ECanbRegs.CANMD.all 		= ECanbShadow.CANMD.all;
    	ECanbShadow.CANME.all 		= ECanbRegs.CANME.all;
    	ECanbShadow.CANME.bit.ME11	= 1;
    	ECanbRegs.CANME.all 		= ECanbShadow.CANME.all;
    
    	if(disp_flag.transmitt_disp_msg_successfuly)
    	{
    		ECanbMboxes.MBOX11.MDL.all 					= ecanb_addressing.word32.ecanb_long2;
    		ECanbMboxes.MBOX11.MDH.all 					= ecanb_addressing.word32.ecanb_long1;
    		ECanbShadow.CANTRS.all 	  					= ECanbRegs.CANTRS.all;
    		ECanbShadow.CANTRS.bit.TRS11 				= 1;
    		ECanbRegs.CANTRS.all 		  				= ECanbShadow.CANTRS.all;
    	}
    }
    
    interrupt void ECANb_mailbox_isr(void)
    {
    	ECanbShadow.CANGIF0.all=ECanbRegs.CANGIF0.all;
    	if(ECanbShadow.CANGIF0.bit.GMIF0 == 1)
    	{
    		ECanbShadow.CANTA.all = ECanbRegs.CANTA.all;
    		if(ECanbShadow.CANTA.bit.TA11==1)
    		{
    			ECanbShadow.CANTRS.all = ECanbRegs.CANTRS.all;
    			ECanbShadow.CANTRS.bit.TRS11 = 0;
    			ECanbRegs.CANTRS.all = ECanbShadow.CANTRS.all;
    			ECanbShadow.CANTA.all = ECanbRegs.CANTA.all;
    			ECanbShadow.CANTA.bit.TA11 = 1;
    			ECanbRegs.CANTA.all =ECanbShadow.CANTA.all;
    			disp_flag.transmitt_disp_msg_successfuly = 1;
    		}
    
    		ECanbShadow.CANRMP.all = ECanbRegs.CANRMP.all;
    		if(ECanbShadow.CANRMP.bit.RMP7  == 1)
    		{
    			ECanbShadow.CANRMP.bit.RMP7 = 1;
    			ECanbRegs.CANRMP.all 		= ECanbShadow.CANRMP.all;
    
    			ecanb_RxMBXnbr 				= 7;
    		}
    
    	}
    	PieCtrlRegs.PIEACK.all |= PIEACK_GROUP9;
    	return;
    }
    
    interrupt void ECANb_system_isr(void)
    {
    	ECanbShadow.CANGIF1.all = ECanbRegs.CANGIF1.all;
    	if(ECanbShadow.CANGIF1.bit.WDIF1  == 1)
    	{
    		ECanbShadow.CANGIF1.bit.WDIF1 = 1;
    	}
    	else if(ECanbShadow.CANGIF1.bit.EPIF1==1)
    	{
    		ECanbShadow.CANGIF1.bit.EPIF1 = 1;
    	}
    
    	if(ECanbShadow.CANGIF1.bit.WUIF1==1)
    	{
    		ECanbShadow.CANGIF1.bit.WUIF1 = 1;
    	}
    
    	if(ECanbShadow.CANGIF1.bit.BOIF1==1)
    	{
    		ECanbShadow.CANGIF1.bit.BOIF1 = 1;
    	}
    
    	if(ECanbShadow.CANGIF1.bit.AAIF1==1)
    	{
    		ECanbShadow.CANAA.all 	  = ECanbRegs.CANAA.all;
    		ECanbShadow.CANAA.bit.AA1 = 1;
    		ECanbRegs.CANAA.all  	  = ECanbShadow.CANAA.all;
    	}
    	if(ECanbShadow.CANGIF1.bit.RMLIF1==1)
    	{
    		ECanbShadow.CANRMP.all	  = ECanbRegs.CANRMP.all;
    		ECanbShadow.CANRMP.bit.RMP7 = 1;
    		ECanbRegs.CANRMP.all	  = ECanbShadow.CANRMP.all;
    	}
    	ECanbRegs.CANGIF1.all 		  = ECanbShadow.CANGIF1.all;
    	PieCtrlRegs.PIEACK.all |= PIEACK_GROUP9;
    	return;
    }
    Hi Harshmeet,

    We are replacing the controller. I will update you on the status.

    Meantime can u look into the CAN configuration in the attached file.

  • Hi,

    Any update.

    Regards
    Harshmeet
  • Hi Harshmeet,

    Sorry, was not available for few days.
    We have changed the controller but the issue is not solved.
    Can you look in the configuration I have sent you?

    Regards,
    Akshay
  • Hi Harshmeet,

    Could you check the configuration?
    I am facing same problem in multiple controllers.

    Regards,
    Akshay
  • Akshay,

                Initially, you mentioned you had a problem in 1 out of 150 controllers. In your last post you mention you have problem in multiple controllers. Unfortunately, there is no clear/concise description of the problem in the thread; "problem in CANB reception" or "controller was getting hanged" does not say much.

    Do you use CAN-A as well? Have you seen a problem with CAN-A in any node? Are the network parameters (cable length etc) the same for both CAN ports? If the problem is intermittent, you may want to look into your bit-timing parameters. I urge you to take a look at http://www.ti.com/lit/an/sprac35/sprac35.pdf. Also, have you looked at my Application Report “Programming Examples for the TMS320x28xx eCAN (http://www.ti.com/lit/an/spra876b/spra876b.pdf )”? If not, please download it read section 3 “Debug and Design Tips to Resolve/Avoid CAN Communication Issues” very carefully. Almost always, you will be able to find the solution using the tips I have provided.

    Have you looked at the bus waveform on an oscilloscope? How "clean" is it?

    Other than what is already stated in the device errata, there is no systemic issue in the CAN module that we are aware of.

     

     

  • Hi Hareesh,

    As I had mentioned I was facing problem only in 1 controller earlier.
    Later on checking in multiple controllers I have faced similar problem in addition 2 controllers.
    I am using CAN A and not faced any such problem.

    After I tried setting these 2 bits in the problematic controllers, I think the issue is solved.
    ECanbShadow.CANMC.bit.ABO = 1;
    ECanbShadow.CANMC.bit.SUSP= 1;

    I am still testing the devices.

    Thank you for the reply.

    Regards,
    Akshay
  • I am glad you believe the issue is solved, but I wonder if you have located the source of the problem. The ABO bit automatically brings a node out of bus-off condition, but my question is why did the node go into BO in the first place? Also, SUSP bit concerns emulation mode (when debugger is connected), not during normal operation. Once again, please read my previous post carefully. Also, please refer to the device errata for applicable issues and ensure you employ the workarounds.