Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
876 Views

Accelerometer Spi Mode Core with NIOS II

Hello, 

 

I am new to the forums and I am looking for some help. I have a DE0 nano development board, and I am trying to use the on board ADXL345 to read out the x, y and z axis on to my connected LT24 display board using a NIOS II processor. I am adapting the DE0 Nano SDRAM painter example from the LT24 demonstration CD. So far, I have added the Accelerometer SPI Mode core into my Qsys project and have loaded the new sof into my board.  

 

The core has the 50MHz clock connected to the clock_reset 

the clk_reset from the 50Mhz clock is connected to the clock_reset_reset pin 

I also have the cpu.data_master connected to the avalon_accelerometer_spi_mode_slave pin 

No other connections. 

 

In NIOS II Eclipse, I have added new code to the main.c file. I have included the core .h file ("altera_up_avalon_accelerometer_spi.h). In the program, I call the alt_up_accelerometer_spi_open_dev function with the name of my accelerometer. I can see in the debugger that this returns the device structure (i can see numbers in the variable watch.. as a test, i typed the name wrong and that returned 0x00). This leads me to believe that it opens ok. 

 

My problem comes when I try to use the alt up accelerometer spi read x axis function. I pass in the reference that I got from the open as well as an alt_32 pointer. However, I cannot get any data back from the function. Additionally, the function always returns 0 (which is supposed to mean success). This returns 0 even if I have the wrong name in the open function. 

 

Sorry for such a long post. If anyone has any experience reading the DE0 nano ADXL345 accelerometer into a NIOS II processor, i welcome any help I can get
Tags (1)
0 Kudos
0 Replies
Reply