I have been working on the XL345 . i want to interface it with BF533 . What is the exact order in which the commands are to be executed ? is there any Hardware changes that i need after we start executing the program ?
It's not clear about what assistance you are looking at the processor end.
It seems that your questions directed more towards ADXL345. If so, please note that you can always use this category of forum for the questions related to Blackfin and its Tools.
Let us know, if you need any help in configuring SPI.
We are planning to add communities that cover other ADI products over time, but currently are unable to answer questions about these products, such as the accelerometer you mention, on Engineerzone. I would suggest submitting your question to the Analog Devices linear application support team in your region. http://www.analog.com/support
Yes , The SPI configuration would help .
I want to know the order in which registers in ADXL345 should be accessed too.
I don't have any experience of working with ADXL345, but by just looking at the SPI timing waveforms shown in device datasheet, I can suggest few things:
- I feel the 4-wire interface should be used to interface it with Blackfin SPI.
- As explained in SPI interface section, use SPI mode3 i.e. CPOL = CPHA = 1
- Since processor is providing clock and CS signal, set MSTR = 1
- LSBF = 0, this will ensure that MSB bit will be sent/received first
- TIMOD field should be set depending on whether your application accesses data in core mode or DMA mode and also whether operation is read or write.
(I feel core mode should be convenient here).
- The SIZE bit (0=>8-bit transfer and 1 => 16-bit transfer) should be configure depending on how you are encoding/decoding data in the processor. The R/W, MB and 6-bit address should be clubbed as a byte (which is transferred by SPI at the start).
Since the basic transfer is of byte-wide, SIZE = 0 should be used.
But if the total number of bytes in an RD/WR operation (including the addressing byte) are even, I feel SIZE = 1 can be convenient for write operations. However, for read operations, setting SIZE = 1 packs received data bytes into 16-bit. (also think about the first invalid received byte).
- set the SPI_BAUD register according to requirement of SCLK. But refer ADXL345 device datasheet for the details about max speed.
- Since CPHA = 1, configure SPI_FLAG register accordingly.
[Note that, BF SPI clock/data will be idle between the each byte/word transfer].
For more details about configuring SPI, refer Hardware Reference manual of processor.
There is a linux-based driver code for ADXL345. It can be found here. The document links to a code.
Message was edited by: AndyR - Fixed broken link.
Retrieving data ...