On Wed, Feb 10, 2010 at 08:47:27AM -0800, Ira W. Snyder wrote:
> On Wed, Feb 10, 2010 at 10:09:34AM +0100, Kurt Van Dijck wrote:
> > On Tue, Feb 09, 2010 at 04:05:00PM -0800, Ira W. Snyder wrote:
> > > Hello all,
> > >
> > > I posted last week asking about a driver for boards running on a PLX
> > > chip. It turns out that these are passive boards. I have been looking
> > > for a driver for the Janz CMOD-IO board CAN interfaces.
> > >
> > > I finally found the datasheets and took the time to write a driver. This
> > > board is an intelligent CAN interface: it has onboard microprocessors to
> > > help process CAN traffic.
> > >
> > > This is a very rough first try at a CAN driver. I'm sure it still has
> > > problems, and I would appreciate if you can take a look and help me add
> > > what is needed. I'm am not extremely knowledgeable about the CAN bus.
> > >
> > > The things that are known to be wrong:
> > >
> > > - bus-on / bus-off handling
> > >
> > > I did this straight in the network device open()/stop() methods. I don't
> > > handle the condition where we get too many bus errors and the bus goes
> > > into bus-off state. What should I be doing here?
> > What you call 'bus-off' is indeed the stop() method. the CAN busoff
> > (which is something different)
> > comes via interrupt (bus-state-change), indicating the
> > can-chip cut itself from the bus. In such case, a special 'struct
> > can_frame' must be emitted to userspace.
>
> Ok. The way I read this: the netdevice open()/stop() methods should put
> the device into "CAN buson" and "CAN busoff" state. In addition, when
> the device has an error, it will go into "CAN busoff" state eventually.
> In this case, I should generate a special CAN frame and send it to
> userspace. Is that right?
Well, the net_device goes up/down (like any other net_device). There is
no such thing as 'CAN buson'. And you can't put the chip in busoff
either. the CAN bus state (error-active, error-passive, bus-off) is a
parameter you can't control (from software, you can shortcircuit the bus
physically to force a bus-off during trasnmissions).
I think it's important to distantiate between these.
You would of course in the end find out you cannot put the chip in
bus-off :-).
>
> > >
[...]
>
> Ira
Kurt
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core