EmbeddedRelated.com
Forums

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

Started by yadunandan kasu February 28, 2008
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
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 6..., "yadunandan kasu"
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
>
>
>
Hi,

> 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.

How you are saying it is recovered from Bus-Off completely did you follow all steps for Micro peripheral CAN module? May be it is in listen mode did you check that.
Are you enabling the Receive Interrupts for CAN after bus off recovery?
If you are not receiving any message are you able to see any ACK error on your CANStress tool(If only two nodes in the NETWORK, of course I never used this tool for my bus monitoring)?

Good luck!!!

Regards,
venki

________________________________
From: 6... [mailto:6...] On Behalf Of kasu nandu
Sent: Friday, February 29, 2008 9:23 AM
To: 6...
Subject: Re: [68HC12] Re: Busoff problem [plz refer to this mail, the previous mail was not perfect]
Hi Mr.Alban,

actually in my sample code, I meant the same for checking the node_status i.e
if((node_status != BUSOFF)&&(node_ status != OVERRUN))

But, I wrote it in a simple way,,actually that is not the issue.
It is my mistake to typed it wrongly,

Mr.Alban, plz imagine that there is no syntax error in the code and suggest me the sollution

Thank you very much
Kasu

Alban Rampon > wrote:
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 6...































































'





&









Hi Mr.Alban,

actually in my sample code, I meant the same for checking the node_status i.e
if((node_status != BUSOFF)&&(node_ status != OVERRUN))

But, I wrote it in a simple way,,actually that is not the issue.
It is my mistake to typed it wrongly,

Mr.Alban, plz imagine that there is no syntax error in the code and suggest me the sollution

Thank you very much
Kasu

Alban Rampon wrote:
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 6..., "yadunandan kasu"
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
>
>
>

regards
Yadunandan Kasu(Nandu)

---------------------------------
Now you can chat without downloading messenger. Click here to know how.
Hi Mr.Venkat

>How you are saying it is recovered from Bus-Off completely did you follow all >steps for Micro peripheral CAN module? May be it is in listen mode did you >check that.

I think i initialized my CAN module correctly. I didnt configure my node to be in Listen only mode.

>Are you enabling the Receive Interrupts for CAN after bus off recovery?
Yes, I do enable my Receive Interrupts for every 10ms irrespective of the Node status.

>If you are not receiving any message are you able to see any ACK error on >your CANStress tool(If only two nodes in the NETWORK, of course I never >used this tool for my bus monitoring)?

CANStress is a tool which is used to simulate the buss errors. I use this tool to generate the Busoff condition. We can not monitor the CAN signals with this tool
I use CANoe for monitoring my CAN messages. But i can not see any error frame (Acknowledgement) in the CANoe tool (in Bus Statistics window)

Venkateshwarlu Kacham wrote:
Hi,

> 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.

How you are saying it is recovered from Bus-Off completely did you follow all steps for Micro peripheral CAN module? May be it is in listen mode did you check that.
Are you enabling the Receive Interrupts for CAN after bus off recovery?
If you are not receiving any message are you able to see any ACK error on your CANStress tool(If only two nodes in the NETWORK, of course I never used this tool for my bus monitoring)?

Good luck!!!

Regards,
venki

________________________________
From: 6... [mailto:6...] On Behalf Of kasu nandu
Sent: Friday, February 29, 2008 9:23 AM
To: 6...
Subject: Re: [68HC12] Re: Busoff problem [plz refer to this mail, the previous mail was not perfect]

Hi Mr.Alban,

actually in my sample code, I meant the same for checking the node_status i.e
if((node_status != BUSOFF)&&(node_ status != OVERRUN))

But, I wrote it in a simple way,,actually that is not the issue.
It is my mistake to typed it wrongly,

Mr.Alban, plz imagine that there is no syntax error in the code and suggest me the sollution

Thank you very much
Kasu

Alban Rampon > wrote:
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 6...































































'





&



















Do you handle receiver overrun condition? Do you clear receiver overrun
status bit?

I'm curious why do you enable CAN interrupts sometimes. Why not to keep RX
interrupt always enabled? Thanks

Edward

----- Original Message -----
From: "kasu nandu"
To: <6...>
Sent: Saturday, March 01, 2008 2:30 PM
Subject: RE: [68HC12] Re: Busoff problem [plz refer to this mail, the
previous mail was not perfect]
> Hi Mr.Venkat
>
> >How you are saying it is recovered from Bus-Off completely did you
> follow all >steps for Micro peripheral CAN module? May be it is in listen
> mode did you >check that.
>
> I think i initialized my CAN module correctly. I didnt configure my
> node to be in Listen only mode.
>
> >Are you enabling the Receive Interrupts for CAN after bus off recovery?
> Yes, I do enable my Receive Interrupts for every 10ms irrespective of
> the Node status.
>
> >If you are not receiving any message are you able to see any ACK error
> on >your CANStress tool(If only two nodes in the NETWORK, of course I
> never >used this tool for my bus monitoring)?
>
> CANStress is a tool which is used to simulate the buss errors. I
> use this tool to generate the Busoff condition. We can not monitor the CAN
> signals with this tool
> I use CANoe for monitoring my CAN messages. But i can not see any
> error frame (Acknowledgement) in the CANoe tool (in Bus Statistics window)
>
> Venkateshwarlu Kacham wrote:
> Hi,
>
>> 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.
>
> How you are saying it is recovered from Bus-Off completely did you follow
> all steps for Micro peripheral CAN module? May be it is in listen mode did
> you check that.
> Are you enabling the Receive Interrupts for CAN after bus off recovery?
> If you are not receiving any message are you able to see any ACK error on
> your CANStress tool(If only two nodes in the NETWORK, of course I never
> used this tool for my bus monitoring)?
>
> Good luck!!!
>
> Regards,
> venki
>
> ________________________________
> From: 6... [mailto:6...] On Behalf Of
> kasu nandu
> Sent: Friday, February 29, 2008 9:23 AM
> To: 6...
> Subject: Re: [68HC12] Re: Busoff problem [plz refer to this mail, the
> previous mail was not perfect]
>
> Hi Mr.Alban,
>
> actually in my sample code, I meant the same for checking the node_status
> i.e
> if((node_status != BUSOFF)&&(node_ status != OVERRUN))
>
> But, I wrote it in a simple way,,actually that is not the issue.
> It is my mistake to typed it wrongly,
>
> Mr.Alban, plz imagine that there is no syntax error in the code and
> suggest me the sollution
>
> Thank you very much
> Kasu
>
> Alban Rampon > wrote:
> 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 6...
































































'





&