hello there from this posthttp://www.cypress.com/forum/psoc-4-ble/psoc-4-ble-adxl362-problem i am trying to interface adxl345 with cy8c4247AZI-M485. but i am not getting data . can you help me??
Two things to mention at first sight:
Writing to ss wil fail because it is connected (wired) to your SPI device. Remove the connection and uncheck in pin's configuration "Hardware Connect".
You are writing 2 bytes, but you are retrieving only one byte. Keep in mind that for every byte sent you get one byte back. So your while-loop will certainly end with the first byte in buffer, but without the second.
hey thanks for your reply. i made changes. but still i am getting 0x00. i have uploaded project here
Have a look into adxl345's datasheet and adjust your CPHA and CPOL accordingly.
I would suggest you to put some more emphasis on a clear and readable structure of your program, no explanations yet, nearly no comments so far and bad indentation. Allocating variables in the middle of a function does not make reading easier... You even do not mention which board the project is made for and that you are accessing an adxl345. In a few months, aftert some other projects done, you will have difficulties to remember all those facts when looking at the sources.
ok thanks for your support
i set according to datasheet. but i am not getting data. 0x00 is device id register. i should return E5 . but i am getting 0x00
...and your latest project state?
thanks for your support. its working. actually i had made mistake in pin assignment
hello there i am getting E5 for device id. but when i am trying to read accelometer x data. i am also getting E5.
You do not send dummy bytes to get x values. Aren't the values 16 bit wide? You'll have to combine two bytes to form a 16 byte int.
yes i need 10 byte. then how many dummy byte should i send??