public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-patches@ecos.sourceware.org
Subject: [Bug 1001897] lpc2xxx CAN driver improvements / enhancements
Date: Tue, 05 Nov 2013 15:41:00 -0000	[thread overview]
Message-ID: <bug-1001897-104-9lyXRcH01A@http.bugs.ecos.sourceware.org/> (raw)
In-Reply-To: <bug-1001897-104@http.bugs.ecos.sourceware.org/>

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001897

--- Comment #26 from Bernard Fouché <bernard.fouche@kuantic.com> ---
(In reply to comment #13)
> > I can't test on the LPC1765 before next week at the earliest and the driver
> > I use is different because of the LPC1765 "pending interrupt problem", but
> > what you describe should appear here also if we have the same CAN cell.
> > 
> > Can you describe what you do on the CAN bus to reach bus off? I could try to
> > reproduce here and see if I also see RM staying at zero.
> > 
> > Did you check the value of EWL? If is 0 or 255 I wonder what happens...
> 
> Create a thread that prints a debug message in a loop via diag_printf (i.e.
> one message per second). Create a second thread that simply sends CAN
> messages (i.e. one message per second). When this application is running,
> simply unplug the CAN bus cable from the CAN connector.
> 
> If your debug message from the thread stops, then you know you are spinning
> in the CAN ISR. You can activate the debug output in the driver to see
> register contents and ISR reason (ICR_BUS_OFF) - it will be printed again
> and again ...

Sorry, it took me ages to be able to go back to that topic.

On the LPC1765, I just did something a bit different than what you wrote, I
unplugged the resistor on the CAN wires. Then I got BEI (Bus Error Interrupt)
in CAN1ICR.

When I look at the error counter, I have 0x00 (Tx) and 0x87 (Rx) while the
warning level is at the default 0x60.

Once I reach this point, the ISR is triggered again and again (and I'm not even
in a bus off condition since the test code didn't have time yet to try to send
a message: it is just floating signals on the wires that shows impossible CAN
frames).

Once the wires aren't floating any more, I have no more such interrupts. It
seems that the only way to stop having these repeated ISR is to reset the CAN
hardware driver or to disable the interrupt that reacts on a bus error or to
have the external condition (in this case bad wiring) to disappear. I did not
find in the documentation how to correctly process that case.

Then I re-installed the resistor but I had only my test node on the CAN bus.
Since no one could acknowledge frames, I had a bus off condition, that worked
as described: TxREC was at 0x7F , and CAN1MOD changed from 0x0 to 0x01 (reset
mode).

Hence in my opinion your patch is not needed on LPC1765 BUT the issue with
floating wires needs some attention and the documentation does not describe
exactly what's going on anyway whatever the version of this CAN cell.

All in all I think it is better to have this kind of processing (taking the
decision to reset the CAN controller) to be handled by higher level code
instead of having the ISR or DSR to magically do things.

I did not encountered problems when I was developing my app since the app
powers off the CAN cell as soon as a bus error or bus off condition occurs.
This is detected by a CAN event call back function that takes immediate action
and also reports this to higher level code. The app re-initialize the CAN a few
seconds later and then tries again to use the CAN bus. So I was immune to the
repeated ISR illness, whatever the reason. And my high level code is always
kept aware about what's going on on the wires.

If the CAN hardware driver is reset without having the app to know about it,
other weird things may  happen, especially if the higher level code assumes
than the CAN controller can recover from bus off by itself, or than a
previously queued message was correctly sent on the bus, etc.

Maybe the feature you added should send a new event reporting that the CAN
controller was reset? So high level code knows that it should be reconfigured
or messages resent? Anyway I don't use LPC22xx parts so for me this is not a
problem!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2013-11-05 15:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  9:37 [Bug 1001897] New: " bugzilla-daemon
2013-08-30 12:37 ` [Bug 1001897] " bugzilla-daemon
2013-08-30 12:38 ` bugzilla-daemon
2013-08-30 14:27 ` bugzilla-daemon
2013-09-02  7:22 ` bugzilla-daemon
2013-09-02 16:22 ` bugzilla-daemon
2013-09-03  6:18 ` bugzilla-daemon
2013-09-03  6:38 ` bugzilla-daemon
2013-09-03  8:20 ` bugzilla-daemon
2013-09-03  8:22 ` bugzilla-daemon
2013-09-03  9:06 ` bugzilla-daemon
2013-09-03 10:48 ` bugzilla-daemon
2013-09-03 12:20 ` bugzilla-daemon
2013-09-03 12:22 ` bugzilla-daemon
2013-09-03 12:31 ` bugzilla-daemon
2013-09-03 12:37 ` bugzilla-daemon
2013-09-03 12:53 ` bugzilla-daemon
2013-09-03 18:52 ` bugzilla-daemon
2013-09-06  8:19 ` bugzilla-daemon
2013-09-06 14:20 ` bugzilla-daemon
2013-09-11 21:23 ` bugzilla-daemon
2013-09-17  6:10 ` bugzilla-daemon
2013-09-17  6:35 ` bugzilla-daemon
2013-09-17 18:39 ` bugzilla-daemon
2013-09-17 18:42 ` bugzilla-daemon
2013-09-18  5:45 ` bugzilla-daemon
2013-09-18  6:46 ` bugzilla-daemon
2013-09-18 16:08 ` bugzilla-daemon
2013-11-05 15:41 ` bugzilla-daemon [this message]
2013-11-06  9:30 ` bugzilla-daemon
2013-11-06 15:28 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1001897-104-9lyXRcH01A@http.bugs.ecos.sourceware.org/ \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=ecos-patches@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).