From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7384 invoked by alias); 3 Apr 2013 16:28:35 -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 7271 invoked by uid 89); 3 Apr 2013 16:28:29 -0000 Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 03 Apr 2013 16:28:29 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 8C587468000A for ; Wed, 3 Apr 2013 17:28:27 +0100 (BST) 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 LK7pfCaRq7G5; Wed, 3 Apr 2013 17:28:26 +0100 (BST) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-patches@ecos.sourceware.org Subject: [Bug 1001268] I2C driver for STM32 Cortex M3 Date: Wed, 03 Apr 2013 16:28: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: mjones@linear.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: 7bit X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00003.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001268 --- Comment #5 from Mike Jones --- Created attachment 2151 --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2151&action=edit Update STM32 I2C Support I tried to contact Martin to see if he had updated code he was willing to contribute, etc, but so far no reply. I am posting a patch. The patch contains: - Updated init function and base defines so that the I2C support works on a STM3240G-EVAL and should work for other STM32F4XX devices. - Attempted to preserve STM32F1XX support but have no means to test - Added support for SMBus timeout - Fixed fast mode clock calculation - Tested with PMBus/SMBus application consisting of three devices - Tested with polling and interrupt driven modes - Added loopback test for others to use Some areas that may warrant change. - The alternate pin assignments are set to the other two pins, but this is not flexible in that it will not adapt to a custom design. It could be improved to enter arbitrary pins in the CDL. - The second I2C is not set to any particular pins of importance and could use the same flexibility. - The ACK portion of the I2C API is not active in the code. This prevents lockups. If there is ever a reason to allow control it could be added, but it needs some thought as to how to prevent lockup. - The clock speed is ignored if changed in the instantiation of the i2c struct. A code override may be added in the future if desired. There is an inconsistency with the Kinetis driver. Kinetis I2C takes a period in the CDL. I think this should be changed to frequency and will change it when other work by Ilija completes. On the eval board this code was reliable in with a real application. Overtime it will get more use and I will fix anything I find. I would not hesitate to use the patch if you need I2C on this platform. However, if anyone has a board with STM32F1XX it would help to test this patch to ensure that version still works. The difference between F1 and F4 is in the GPIO configuration registers. I made almost no changes to the core code, so if it does not work, it is almost certain to be in the init code. I believe Martin has an assignment. I have one. So we should be able to get this into the codebase. -- You are receiving this mail because: You are on the CC list for the bug.