From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3655 invoked by alias); 5 Nov 2013 15:41:29 -0000 Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org Received: (qmail 3631 invoked by uid 89); 5 Nov 2013 15:41:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail.ecoscentric.com Received: from Unknown (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 05 Nov 2013 15:41:27 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id B71D64680001 for ; Tue, 5 Nov 2013 15:41:17 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OT3xUG9Hqzg0; Tue, 5 Nov 2013 15:41:12 +0000 (GMT) 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: Patches and contributions X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: bernard.fouche@kuantic.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg00000.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001897 --- Comment #26 from Bernard Fouch=C3=A9 --- (In reply to comment #13) > > I can't test on the LPC1765 before next week at the earliest and the dr= iver > > 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. > >=20 > > Can you describe what you do on the CAN bus to reach bus off? I could t= ry to > > reproduce here and see if I also see RM staying at zero. > >=20 > > Did you check the value of EWL? If is 0 or 255 I wonder what happens... >=20 > 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. >=20 > If your debug message from the thread stops, then you know you are spinni= ng > 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 Interrup= t) 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 s= end a message: it is just floating signals on the wires that shows impossible C= AN 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 C= AN 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 n= ot 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 work= ed as described: TxREC was at 0x7F , and CAN1MOD changed from 0x0 to 0x01 (res= et 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 act= ion 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 t= he 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 reconfigur= ed or messages resent? Anyway I don't use LPC22xx parts so for me this is not a problem! --=20 You are receiving this mail because: You are on the CC list for the bug.