Hi
I am using code warrior with PE. And FRDM-K20D50M board, I Want to read the "who_am_i register" of the FXOS87000CQ accelerometer-magnetometer the address of the register is 0x0D. I am using SPI_Master_LDD component from PE I couldn't find any syntax for querying the registers. As WHO_AM_I is the easiest thing to read in any such ICs, After that I have to read the accelerometers and magnetometer's x,y,z values. but I am stuck in this. The receive blocks i.e SM1_ReceiveBlock(spipointer, rbuff, sizeof(rbuff)); doesn't have any bit field to read any register. Is there any sample code for handling the sensors using SPI ? Kindly look into the matter.
Regards
Amit Kumar
Hi Amit,
I've created a new thread following your last comments:
https://community.freescale.com/thread/322753
I will ask info to other teams and will keep you informed via the new thread.
Regards
Pascal
Hi Amit,
you might have a look at Review: New FRDM-KL26Z Board | MCU on Eclipse (search for FXOS8700): I wrote a driver and component which uses the WHO_AM_I register, so you can have a look at this example and driver.
I hope this helps,
Erich
Hi Erich
Thanks for the link, Actually I wanted to learn using SPI how can we read the registers? I have used this module in one of my project but it is i2c based. I have some others sensors also which is SPI based so for that I wanted to use SPI. If basic principle of making sensor work using SPI is clear then it will be easy for me as well as other forum members using them too.
Thanks & Regards
Amit Kumar
Hi Amit,
ok, I see.
Here are a few examples I use with SPI, and maybe this gives you what you need:
http://mcuoneclipse.com/2014/01/05/frdm-with-ardino-ethernet-shield-r3-part-1-sd-card/
http://mcuoneclipse.com/2014/01/25/frdm-with-arduino-ethernet-shield-r3-part-3-embedded-web-server/
I hope this helps,
Erich
Hi Erich
Thanks for the above links, From the 3rd link u provided, I got some pointers on how to work as there is a method created by you which says " uint8_t SPI_ReadRegister(uint8_t reg) " and similarly for write register. I tried to make it work but was not successful. I will again try using it. Any suggestions how to deal with it?
Thanks & Regards
Amit Kumar