avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] AVR and accelarometers


From: Shashank Chintalagiri
Subject: Re: [avr-chat] AVR and accelarometers
Date: Sat, 17 Nov 2007 20:04:49 +0530

Well, I'm just a hobbyist of sorts so I probably am missing some of
the finer points involved, but the SPI interface on the
microcontroller I use (an ATMega) is quite trivial to use. I'm quite
sure most AVR microcontrollers have a built in SPI subsystem. In some
cases they seem to have a universal serial interface for
spi/i2c/usart, and I havent used those very often so cant talk about
them. Some even seem to have 2 built in SPI busses.

I've been using various SPI devices on and off recently, mostly just
for trying it out after getting myself interested in data busses, and
almost always the hardest and most effort-requiring part of the
process was reading through the datasheet and hard-coding each of the
commands, which is also more an issue of concentration and
perseverance than a technical difficulty. In the most basic use cases
for the spi bus, the aprropriate spi line (miso, mosi, sck, along with
ground) and an additional chip-select line (I dont use the ss line,
the chip select for the atmega itself to control other spi devices to
make life a little simpler for myself : the error handling code if the
line accidentallly goes low pushing the atmega into slave mode is
something i can do without). I've written a couple of simple c++ files
with some basic spi functions, and higher level files with the
functions specific to each spi device, and i just have to included
them in my code to use the devices henceforth.

The SPI as a communication bus is faster than the I2C bus and is
ridiculously easy to hardcode if you need to (the MCU I use can only
do 8-bit SPI, and one of the Nokia LCDs uses 9-bit SPI for
communication.). The I2C bus seems to me to be better in cases where
there are a _large_ number of devices with smaller volumes of bus
transactions, or if the devices can wait for a considerable amount of
time before reporting back their data. Also, the I2C bus is a multi
master bus, and I have a feeling you wont need to run accelerometers
as bus masters :P . The fastest SPI my MCU can handle is 2Mbps. I seem
t remember reading somewhere about it being in the SPI specification
for 2 Mbps to be the maximum, but I cant be sure. The data transfer
rate is not high enough to warrant major concerns over Electromagnetic
Interference (I had concerns about a 10 MHz signal for which I was
scoffed at by someone on IRC, #hamradio I think. "Good old DC", he
called it) As long as you dont blatantly ignore the rules of pcb
design you should do fine. Just try to keep the SPI bus traces as
short as possible, away from other high frequency signals, and have a
ground trace running close by.

The SPI does seem to mess with the programming of the MCU though. For
me, it has always failed at the verification part, but the code got
written fine. I believe this to be a problem with SPI devices not
appearing as high-Z when the chip is not selected, and I have a theory
that using a tri-state bus buffer between the MCU and the SPI bus,
with the control tied in to the reset that goes low during
programming. That way you can automatically disconnect the bus while
programming and the universe will start to make sense again. This is
but a theory though. I havent been able to get my hands on a tri-state
bus buffer yet, and to me the problem is rather trivial due to the
non-permanent nature of my board. I just physically disconnet my SPI
devices when programming if i get a verify error and rewrite.

Hope this helps.

P.S. : I could be _way_ off in any or all of my statements, so please
take them with a pinch of salt. These have just been my experiences
and I can't guarantee you'll have anything like this when you try.



On Nov 16, 2007 2:48 AM, nautilussoftware <address@hidden> wrote:
>  hello; I am interested in connecting several accelerometers to an atmel and
> maybe using a processor that supports USB. I found an accelerometer that
> uses SPI bus. how hard would it be to design the interface to the part if
> anyone could ballpark it. I have not done electrical design in a while. So I
> was thinking of getting a development kit for the AVR. is there an
> inexpensive kit that will do usb around? this was the chip I found but I did
> not know where the price was.
> http://www.vti.fi/en/products-solutions/products/accelerometers/sca3000-accelerometers/
> I would be willing to barter also some software engineering time for some
> electrical design or board layout. I have 20 years in software. thanks
> -peter
> ________________________________
>  View this message in context: AVR and accelarometers
>  Sent from the AVR - General mailing list archive at Nabble.com.
>
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat
>
>



--
________________________________
Chintalagiri Shashank
Junior Undergraduate
Department of Physics
Indian Institute of Technology, Kanpur

address@hidden
address@hidden
http://home.iitk.ac.in/~chintal
________________________________




reply via email to

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