avrdude-dev
[Top][All Lists]
Advanced

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

[avrdude-dev] How to add I2C device disable preamble?


From: Bob Paddock
Subject: [avrdude-dev] How to add I2C device disable preamble?
Date: Tue, 10 Apr 2007 09:34:39 -0400
User-agent: Opera Mail/9.10 (Win32)


I do a lot of designs involving
Accelerometers.  ST has a couple
that have been on the market,
and an other Semi. Manufacture
is about to announce one,
that have digital interfaces.

These parts have a dual SPI/I2C
interface.  If the SPI Chip-Select
line is deasserted then the part
is in I2C mode.

Some of the devices give you a bit
you can set to disable the I2C interface,
but they seem to be missing the point
that, that approach does not work.
ST doesn't, or at least did not,
acknowledge the problem, and the
new player didn't know they had this
problem until I just explained it to them,
a few minutes ago.

As the AVR uses the SPI port to
program the device while it is on the board,
to load the initial program.  There is no
program to run yet, you can't program
the I2C disable bit. :-<

The problem is problematic as it depends
on your programming data stream.  If
you are lucking your data stream
will not contain the I2C address
that wakes up the part;
I never have that kind of luck.

The I2C interface sees
one of the bytes in the programming data
stream as its own wakeup address, and puts
out a "ACK" bit.  The programming SPI
interface sees this "ACK" bit as bad data,
or an extra clock, which hoses the program
transfer, and the programming process aborts.
You now have a chip soldered to the board,
that is impossible to program, and you can't
set the I2CDIS bit, to prevent the problem.
Been there-done-that.  :-(

I had to change my AVR/ST design to not
use the SPI port, and go with a software
bit-banged SPI version on I/O pins,
to talk to the Accelerometer.  This
is less than idea, especially where you
might need fast response to take
advantage of the Fall Detection attributes
of newer parts.

I avoid I2C parts in critical systems
due to them being prone to locking up.  Do a Internet
search and you find this is a very common
problem with I2C parts.  Linear Tech.
goes so far as to make a bus isolator
chip to unlock the bus.

With that background, what I was thinking
about was adding some type of 'preamble'
to AVRDUDE, that would talk to the
dual mode parts in I2C mode to disable
I2C mode, which remains to be seen if that
can even be done, as your turning of the
interface your using.  You can't use the
SPI mode as you don't have control
of the Accelerometer Chip Select line,
from AVRDUDE.

Does it make sense to  take
this approach, or does someone have
a better idea?

Assuming I go down this road,
what sections of code should I be looking
at to add this feature?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]