« Return to Thread: Busoff problem [plz refer to this mail, the previous mail was not perfect]

Re: Busoff problem [plz refer to this mail, the previous mail was not perfect]

by Nabla69 :: Rate this Message:

Reply to Author | View in Thread

Hello,

I see an error in your code:

if(node_status != BUSOFF/OVERRUN)

With / (divided), you probably meant a | (OR) but even then I would
think it is wrong.
The way you wrote the rest of extract I would replace by:

if((node_status != BUSOFF)&&(node_status != OVERRUN))

because your status is a direct assignment with an "=", it is not
possible for you to have both BUSOFF and OVERRUN in the same time. And
that is what BUSOFF|OVERRUN means as the OR has priority (and it would
not mean anything otherwise).

In that case you will inside your if if the status is !=BUSOFF AND
!=OVERRUN.

Does this work better ?

Regards,
Alban Rampon
http://claimid.com/AlbanRampon



--- In 68HC12@..., "yadunandan kasu" <yadunandankasu@...>
wrote:

>
>
> Hi everyone,
>
> I am using S12MSCANV2 can protocol for my application.
>
> I have an issue here
>
> As we all know, When the nodes enters the Busoff state, it is not
> allowed to participate in the communication untill recovery to normal
> state.
>
> The following two are my sample codes in which one enables my Transmit
> interrupt for every 10ms and the other one in CAN error interrupt ISR.
>
> CAN_Tx_Routine()
> {
>    if(timer > 10ms)
>    {
>      if(node_status != BUSOFF/OVERRUN)
>      {
>        enable Tx interrupt;   /* enables the CAN Tx interrupt */
>      }
>    }
> }
>
> interrupt _CAN_Error_ISR()
> {
>      if(CAN0RFLG_TSTAT == 3) /* if node stauts is busoff */
>      {
>          node_status = BUSOFF;
>          DisableInterrupts;
>          CAN_Init_Reg(); /* this contains the CAN controller registers
> intialization */
>          EnableInterrupts;
>      }
> }
>
> Every thing works fine with the above sample code when i create an
> bus-off condition i.e. My node can receive and transmit messages after
> recovery from busoff state.
>
> But, I tried something different, i.e. I enable my Transmit interrupt
> for every 10ms irrespective of the Node status like below. i.e i am not
> checking whether my node is in Error passive or busoff or over run in my
> Tx routine.
>
> i.e. Even though, busoff occurs, this routine keep enabling the Transmit
> interrupt.
>
> CAN_Tx_Routine()
> {
>    if(timer > 10ms)
>    {
>        enable Tx interrupt;
>    }
> }
>
> Now, I created the bus-off condition (using CANstressDR tool). But,after
> recovery from the bus-off, my node can not receive any messages from the
> other node or the network. But it can send all of its Transmit messages
> on the network perfectly.
>
> I know that the node should not participate in the communication during
> busoff, but I want to know what's happening in the system when my node
> is trying to send mesages to the network during busoff.
>
> Can anyone tell me the reason for this..? It would be greatly helpfull
> to me.
>
> thanks & regards
> Kasu
>
>
>
> [Non-text portions of this message have been removed]
>


 « Return to Thread: Busoff problem [plz refer to this mail, the previous mail was not perfect]