get data from l3g4200d with spi protocol
mohammadesmaili
Posts: 8
hello
i want to get data from l3g4200d with use spi protocol and i dont know what data i shoud send to sensor to get data.SDO port of sensor is always set.please tell me
what data i shoud send to sensor
i want to get data from l3g4200d with use spi protocol and i dont know what data i shoud send to sensor to get data.SDO port of sensor is always set.please tell me
what data i shoud send to sensor
Comments
Edit: You will need to substitute your Propeller port#'s were they are commented in the main method - dio = sda, clk = scl, cs = cs on the module. Also you need to give it up to about 7 seconds before you see a display
i use ARM micro and my code is in keil program. i cant read spin file.
for example when i send 0xA1 to SDA port of sensor ,according to l3g4200d datasheet i shoud get data from XL register but i didnt get anythings.
In this program mo I send $81 to $23, $08 to $22, $0f to $20 to set it up then monitor $27 for bit 4 to go high (data is ready) then read $28 thru $2d to get axis data. I hope this helps mo.
i use spi with four wire
according to datasheet if i want to get data from XL register i shoud send 0xA1(0X10100001).
1-Bit 0: READ bit. The value is 1.
2-Bit 1: MS bit. When 0, do not increment address; when 1, increment address in multiple
reading.
3-Bit 2-7: address AD(5:0). This is the address field of the indexed register.
4-Bit 8-15: data DO(7:0) (read mode). This is the data that is read from the device (MSb first).
i get this four note from datasheet. in note 3 said that we have six bit for address but the address of registers is 7 bit .do you underestand what mean that?
another question is that if i want to use Multiple byte reading whate shoud i do?
Edit: This module can be used with four wire SPI. Also it is the register address that needs to be modified with the proper bits cleared/set for write/read and non increment/ increment address. Also the byte needs to have the bits in it be reversed as the chip normally expects the most significant bit first.
ratronic, in spi with 4 wire if i want to get data from OUT_XL register with 0x28 address, what data i shoud send to sensor?
thanks alot for your information.