Cheap 3D accelerometers and SPI issues.

Just added support for Kionix accelerometers to the Butterflylogger project. In particular the KXPS5 using the breakout PCB from Crodnet. The main advantage of this accelerometer of others as far as I can see is the price as well as having both digital (SPI and I2C) as well as analogue interfaces.

Had a small hiccupp in getting the SPI bus to behave. It seemed that when I drove the SCLK line while clocking out a response from the accelerometer, the cross talk (with the MISO Line) would interfere with the output (see above)

After a number of ineffective tweaks with speed and the IO setup for the lines I decided to shorten the lines. After shortening the lines all the problems went away. For reference the original lines were approximatly 10cm between the butterfly and the breakout board.

NOTE: the code for talking to the accelerometer is KXPS5-3157.c and KXPS5-3157.h The will be included in the next code release but for the meantime you will need to get them from the CVS repository.

Leave a Reply