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 CAN bus mailboxes stuck

We have configured and are trying to diagnose a problem with our eCANB module.

In our setup we have 2 DSP's with eCANB module connected between them using twister pair wires and have termination resistors connected at each DSP.  We have set aside mailbox 12 to 31 as transmit mailboxes.

Can is communicating fine when the wires are connected between the 2 modules and termination resistor connected.

If we disconnect the twister pairs from one module, leaving the termination resistor in place, CAN goes to error passive state and stays there.  When we reconnect the twister pair cable on the module, we recover and transmission/reception resumes.  We have no problem with this failure mode.

However, when we disconnect both the twisted/wire and the termination resistor from one module we go into error passive state (CANES.EP ==1) and bus off state (CANES.bit.BO ==1).  We have CANMC.ABO  set to 1 so that the CAN restarts automatically and it keeps cycling through EP and BO (since we are still disconnected). Typically when we reconnect the wire and the termination resistor we recover and transmission/reception resumes.  In rare intermittent cases (1/100 ) we do not recover (transmit does not resume, receive does).  When this failure mode is occuring we observe that our transmit mailboxes are all enabled (CANME=FFFF FFFF), transmit requests for the transmit mailboxes are all set (CANTRS = FFFF F000).  we see no acknowledgement (CANAA = 0), also CANTA = 0 and CANTRR = 0.  The MSGID and MSGCTRL registeres for all our mailboxes have correct data corresponding to the intended packets we are trying to transmit. 

We have a counter that increments in our transmit hardware interrupt and we observe that counter has stopped incrementing (the interrupt is not running)

Everything looks good to resume transmitting however there is none and we are trying to figure out why this happens ???

ps. we are periodically setting CANTRR for all our transmit packets when we are in error passive state.  We are aware of the silicon errata with aborting transmission and we and are running the following code periodically to fix it.

 uint32_t canme, canta, cantrs, cantrr, canmd;
	{
		CriticalSection enter( IER_DMA_ONLY);
		canme = Regs->CANME.all;
		canta = Regs->CANTA.all;
		cantrs = Regs->CANTRS.all;
		cantrr = Regs->CANTRR.all;
		canaa = Regs->CANAA.all;
		canmd = Regs->CANMD.all;
	}
	
	// Somehow, after rolling through a bus off state, a mailbox may end up configured
	// for transmission, but with neither a transmission pending or an abort request.
	// Clear such mailboxes out.
	// Note: This has since been linked to the silicon errata for the TMS320F28335
	uint32_t mysteryState =
		canme &   // enabled
		~canmd &  // configured for transmit
		~canta &  // not in transmit ack
		~cantrs & // not in transmit request
		~cantrr & // not in transmit abort request
		~canaa;   // not in transmit abort ack
	if (mysteryState != 0) 
	{
		ErrorCountBoxReset++;
		CriticalSection enter( IER_DMA_ONLY);
		uint32_t canme = Regs->CANME.all;
		Regs->CANME.all = canme & ~mysteryState;
	}