* iMX28 and CAN Error frames
@ 2013-03-15 16:16 Tobias.Grueninger
2013-03-15 21:23 ` Robert Schwebel
2013-03-17 19:00 ` Wolfgang Grandegger
0 siblings, 2 replies; 3+ messages in thread
From: Tobias.Grueninger @ 2013-03-15 16:16 UTC (permalink / raw)
To: linux-can
Hi,
I have trouble in receiving error frames on my freescale iMX28 board.
Linux mx28 2.6.35.3-g880e772 #35 Mon Jul 30 15:04:31 CEST 2012 armv5tejl GNU/Linux
In normal operation, many telegrams are received and some are sent from the iMX28.
Now I want to implement the error handling. After many trials, I am now out of my wisdom..
The situation is that when I craft manually an error frame and send this on my console to can0
cansend can0 20000040#
then my application does nicely receive this: (/* are my comments)
************
virtual void OCanModelPrivate::run(): current telegram: 0X14042240 /* Normal telegram, frame.can_id & CAN_EFF_MASK
>>>send error frame from other console
virtual void OCanModelPrivate::run(): current telegram: 0X40 /* the error frame
CAN_ERR_FLAG raised: CAN_ERR_BUSOFF /*debug output
run: 20000040 0 - 00 00 00 00 - 00 00 00 00 /*debug output
*************
But, if I e.g. short circuit the CAN Bus to provoke a real Bus Off problem:
***********
virtual void OCanModelPrivate::run(): current telegram: 0X140222C0
virtual void OCanModelPrivate::run(): current telegram: 0X80422C0
>>>CAN short circuit
/* nothing happens..
virtual void OCanModelPrivate::run(): no data in the last 5s /* comes from select() timeout
OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0: /* comes from "if (FD_ISSET(s, &rdfs)) {..} else{.."
virtual void OCanModelPrivate::run(): no data in the last 5s
OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0:
OCanModelPrivate::sendMessage:write: No buffer space available /* comes from "if ((nbytes = write(s, &frame, sizeof(frame))) != sizeof(frame))"
OCanModelPrivate::sendMessage:write: No buffer space available
virtual void OCanModelPrivate::run(): no data in the last 5s
OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0: Success
OCanModelPrivate::sendMessage:write: No buffer space available
OCanModelPrivate::sendMessage:write: No buffer space available
**************
The Error mask is this:
can_err_mask_t err_mask = CAN_ERR_MASK;
if ( setsockopt(d->s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask, sizeof(err_mask)) ) {.}
Where can be searched, or what did I not understood?
Best Regards / Mit freundlichen Grüßen / Cordialement
Tobias Grüninger
Emerson Network Power GmbH | Niederlassung Erlangen, Schallershofer Str. 141 | 91056 Erlangen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: iMX28 and CAN Error frames
2013-03-15 16:16 iMX28 and CAN Error frames Tobias.Grueninger
@ 2013-03-15 21:23 ` Robert Schwebel
2013-03-17 19:00 ` Wolfgang Grandegger
1 sibling, 0 replies; 3+ messages in thread
From: Robert Schwebel @ 2013-03-15 21:23 UTC (permalink / raw)
To: Tobias.Grueninger; +Cc: linux-can
On Fri, Mar 15, 2013 at 04:16:08PM +0000, Tobias.Grueninger@Emerson.com wrote:
> I have trouble in receiving error frames on my freescale iMX28 board.
> Linux mx28 2.6.35.3-g880e772 #35 Mon Jul 30 15:04:31 CEST 2012 armv5tejl GNU/Linux
That sounds like a Freescale kernel, not mainline. The community mailing
lists usually only support the mainline kernel.
Please try your test again on 3.8.x. It should support most of i.MX28
nicely.
rsc
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: iMX28 and CAN Error frames
2013-03-15 16:16 iMX28 and CAN Error frames Tobias.Grueninger
2013-03-15 21:23 ` Robert Schwebel
@ 2013-03-17 19:00 ` Wolfgang Grandegger
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Grandegger @ 2013-03-17 19:00 UTC (permalink / raw)
To: Tobias.Grueninger; +Cc: linux-can
Hi Tobias,
On 03/15/2013 05:16 PM, Tobias.Grueninger@Emerson.com wrote:
> Hi,
>
> I have trouble in receiving error frames on my freescale iMX28 board.
> Linux mx28 2.6.35.3-g880e772 #35 Mon Jul 30 15:04:31 CEST 2012 armv5tejl GNU/Linux
The Flexcan driver hit mainline in 2.6.36. Therefore the first question
is where the driver comes from. Is this a kernel from Freescale? Any
chance to switch to a recent mainline kernel version?
> In normal operation, many telegrams are received and some are sent from the iMX28.
>
> Now I want to implement the error handling. After many trials, I am now out of my wisdom..
Error handling should work properly in recent version of the Flexcan
driver (from the mainline kernel).
>
> The situation is that when I craft manually an error frame and send this on my console to can0
> cansend can0 20000040#
>
> then my application does nicely receive this: (/* are my comments)
> ************
> virtual void OCanModelPrivate::run(): current telegram: 0X14042240 /* Normal telegram, frame.can_id & CAN_EFF_MASK
> >>>send error frame from other console
> virtual void OCanModelPrivate::run(): current telegram: 0X40 /* the error frame
> CAN_ERR_FLAG raised: CAN_ERR_BUSOFF /*debug output
> run: 20000040 0 - 00 00 00 00 - 00 00 00 00 /*debug output
> *************
>
> But, if I e.g. short circuit the CAN Bus to provoke a real Bus Off problem:
> ***********
> virtual void OCanModelPrivate::run(): current telegram: 0X140222C0
> virtual void OCanModelPrivate::run(): current telegram: 0X80422C0
> >>>CAN short circuit
> /* nothing happens..
>
> virtual void OCanModelPrivate::run(): no data in the last 5s /* comes from select() timeout
> OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0: /* comes from "if (FD_ISSET(s, &rdfs)) {..} else{.."
> virtual void OCanModelPrivate::run(): no data in the last 5s
> OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0:
> OCanModelPrivate::sendMessage:write: No buffer space available /* comes from "if ((nbytes = write(s, &frame, sizeof(frame))) != sizeof(frame))"
> OCanModelPrivate::sendMessage:write: No buffer space available
> virtual void OCanModelPrivate::run(): no data in the last 5s
> OCanModelPrivate::run():FD_ISSET == 0 , no data read possible from CAN0: Success
> OCanModelPrivate::sendMessage:write: No buffer space available
> OCanModelPrivate::sendMessage:write: No buffer space available
> **************
>
> The Error mask is this:
> can_err_mask_t err_mask = CAN_ERR_MASK;
> if ( setsockopt(d->s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask, sizeof(err_mask)) ) {.}
>
> Where can be searched, or what did I not understood?
See above. Have a look to
http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c
Wolfgang.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-17 19:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15 16:16 iMX28 and CAN Error frames Tobias.Grueninger
2013-03-15 21:23 ` Robert Schwebel
2013-03-17 19:00 ` Wolfgang Grandegger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).