NetBSD Problem Report #48932

From www@NetBSD.org  Sat Jun 21 01:20:16 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 72177A5816
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 21 Jun 2014 01:20:13 +0000 (UTC)
Message-Id: <20140621012010.80320A653F@mollari.NetBSD.org>
Date: Sat, 21 Jun 2014 01:20:10 +0000 (UTC)
From: yunixx@gmail.com
Reply-To: yunixx@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Raspberry Pi i2c  ioctl returns success even though i2c slave device NACKed
X-Send-Pr-Version: www-1.0

>Number:         48932
>Category:       port-arm
>Synopsis:       Raspberry Pi i2c  ioctl returns success even though i2c slave device NACKed
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-arm-maintainer
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 21 01:25:00 +0000 2014
>Closed-Date:    
>Last-Modified:  Sun Jun 12 03:33:21 +0000 2016
>Originator:     Yunis Mustafa
>Release:        evbarm-earmhf/201405181900Z
>Organization:
>Environment:
NetBSD rpi 6.99.42 NetBSD 6.99.42 (RPI) #0: Sun May 18 20:34:46 UTC 2014  builds@b44.netbsd.org:/home/builds/ab/HEAD/evbarm-earmhf/201405181900Z-obj/home/builds/ab/HEAD/src/sys/arch/evbarm/compile/RPI evbarm
>Description:
i2c bus protocol analyzer capture shows that the i2cscan utility's ioctl(I2C_OP_WRITE_WITH_STOP) was NACK-ed (well, devices with most of those addresses don't exist), but the ioctl returned success. This is causing the i2cscan utility to detect phantom devices which do not exist.

This was observed with my own application talking to an i2c slave device I am using. The problem I have with this is that my slave device will NACK when it is busy, but I cannot programmatically detect this and retry the write request because the ioctl will return success even when the actual write operation was NACK-ed/failed.

I have i2c capture screenshots which show the i2c data for further information. Not sure how to load the screen shots to this PR though.

>How-To-Repeat:
- Setup I2C Bus Capture (I use saleae product)
- Run "i2cscan /dev/iic1"
- Obserce the i2c bus capture output - notice NACKs for devices which do not  exist.
- But i2cscan will print that device was found for that address.

>Fix:

>Release-Note:

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48932 CVS commit: src/sys/arch/arm/broadcom
Date: Sat, 24 Jan 2015 00:23:37 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Sat Jan 24 00:23:37 UTC 2015

 Modified Files:
 	src/sys/arch/arm/broadcom: bcm2835_bsc.c

 Log Message:
 Catch NAKs from the device more often.

 Should fix PR#48855 and maybe PR#48932.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_bsc.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 12 Jun 2016 03:33:21 +0000
State-Changed-Why:
Did the commit (almost a year and a half ago now (!)) fix the problem?


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.