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: KIYOHARA Takashi <kiyohara%kk.iij4u.or.jp@localhost>
Date: Tue, 08 Jul 2008 11:33:43 +0900 (JST)

> > > > 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). 

hmm... I am confusing.  ;-<
However very noisy.  I will try to once debug.

Thanks,
--
kiyohara


Home | Main Index | Thread Index | Old Index