Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ADXL345 and XMEGA256 SPI

Status
Not open for further replies.

ejleiss

Junior Member level 2
Junior Member level 2
Joined
Jul 2, 2009
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,446
Hello,

I'm having some trouble with the ADXL345 communicating via 3 wire SPI on my XMEGA256. I am using Atmel Software Framework with the XMEGA. If anyone has done this before I would appreciate some direction initiating the accelerometer to stream data. Here is what I have.

Code:
spi_select_device(&SPIC, &spi_device_conf);
	delay_ms(1);
	
	spi_write_single(&SPIC, DATA_FORMAT);						// Write to Data_Format Register
	spi_write_single(&SPIC,0x4B);								// 16g full resolution
	spi_write_single(&SPIC, POWER_CTL);						// Write to Power_CTL Register
	spi_write_single(&SPIC, 0x2D);							// Start Measurement
	spi_write_single(&SPIC, INT_ENABLE);						// Write to INT_ENABLE
	spi_write_single(&SPIC, 0x80);							// Enable Data_Ready Interrupt

	spi_deselect_device(&SPIC, &spi_device_conf);

Then can I just do an spi_read_single(&SPIC, data); and do what I wish with the values stored in data?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top