FXPS7115D4: how to read sensor data using SPI?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

FXPS7115D4: how to read sensor data using SPI?

跳至解决方案
3,880 次查看
tcachat
Contributor I

We have already designed, build, assembled and program a board with an FXPS7115D4 using the I2C link, and it works well. Now we have designed, build and assembled a new board with an FXPS7115D4 using the SPI link. The main problem is that I do not manage to read the sensor data. Previously, using I2C, reading registers 62h and 63h was ok. Now, using SPI, I got 16 bit values very close to 0000h or to FFFFh (e.g. 64FFFE1Eh, 64FFFF31h, 640000CBh, ...). On the other side I can read the temperature register (address 0Eh), and the returned value looks correct.

  1. Went something wrong during the initialisation ?
  2. Do I need to use the "Sensor data request command" instead of the register read? I cannot understand what the "SOURCEID" is, and how to use it. A use case would be appreciated.
  3. Without https://community.nxp.com/t5/Sensors/FXPS7115D4/m-p/1310520 I would never have found the AN12731, which helped me a lot for the CRC calculation. Thank you @Fast !
  4. In AN12731, I think the line u32_cmd_msg |= ((RegisterData << & 0xF0000000); should be replaced by u32_cmd_msg |= ((RegisterData << & 0xFF00);
  5. In FXPS7115D4 data sheet, "7.5.5.3 SPI error", "The number of SCLK rising edges detected while SS_B is asserted is not equal to 16" should be 32???

Thank you

0 项奖励
回复
1 解答
3,876 次查看
Fast
Contributor V

You will need to initialise with:

For filtered pressure 0x804240AF

For fast pressure 0x8042203A  

And then collect the 16bit pressure data.

Works fine with 2 * 16bit SPI transferes.

 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
3,855 次查看
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Thierry,

Let me add few other comments...

3. I have asked my colleagues from the PL Pressure Sensors to add the AN12731 to the Documentation tab of FXPS7 Family/FXPS7115D4 websites.

4. You are right. They are currently working on an update of the FXPS7xxx code where it will be implemented (in sensor_common.c for SPI example) as follows:

Picture.jpg

The updated FXPS7xxx driver including an example code should be available at the beginning of next week on this website. The AN12731 will be updated as well.

5. Yes, as it is a 32-bit SPI. 

Best regards,

Tomas

 

0 项奖励
回复
3,849 次查看
tcachat
Contributor I

Thank you Tomas.

Strangely on FXPS7 Family only 3 components appear in the datasheet tab. And from FXPS7115D4 I could not find any link to the family, even in "Similar Products"...

0 项奖励
回复
3,848 次查看
tcachat
Contributor I

Moreover, how could I find the link to Sensor Drivers for NXP Sensors?

0 项奖励
回复
3,869 次查看
tcachat
Contributor I

Thank you @Fast 

It is working now. Reading register 0x62, I get e.g. 0x6486F262. I forgot to write to register 0x42.

What do you mean with "Works fine with 2 * 16bit SPI transfers" ?

0 项奖励
回复
3,877 次查看
Fast
Contributor V

You will need to initialise with:

For filtered pressure 0x804240AF

For fast pressure 0x8042203A  

And then collect the 16bit pressure data.

Works fine with 2 * 16bit SPI transferes.

 

0 项奖励
回复