Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mistake the i2c_bitbang direction



Hi! tsutsui-san,


From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
Date: Tue, 8 Jul 2008 04:25:12 +0900

> > > I think mistake to set the direction.  We necessary DIR(INPUT) before 
> > > READ,
> > > and DIR(OUTPUT) before SETBITS().
> > 
> > No.
> > 
> > DIR() should be used only for SDA, not for SCL.
> > As I noted in the log message, using DIR(INPUT) to read SCL
> > in i2c_wait_for_scl() causes unexpected stop condition
> > in SCL=H, SDA=L and DIR(OUTPUT) case.
> 
> Furthermore, we have to do SETBITS() before DIR(OUTPUT) in some case
> otherwise the device might put unexpected glitch during delay between
> DIR(OUTPUT) and SETBITS().

Perhaps, it understood.
Then, we should not call i2c_wait_for_scl() in i2c_bitbang_send_start()
and i2c_bitbang_{read,write}_byte().  He will read the i2c bus.  If he is
called, we should set DIR(INPUT) it ahead of that.
Moreover, it will have to be checked that a variable 'bit' is not SDA in
i2c_bitbang_{read,write}_byte().  Possibly set DIR(OUTPUT). 

Thanks,
--
kiyohara


Home | Main Index | Thread Index | Old Index