ST意法半导体
直播中

曹雪

7年用户 255经验值
私信 关注
[问答]

更改hts221的控制寄存器没有任何改变

嗨,


我正在使用STM32f469迪斯科板和x-nucleo-iks01a1扩展板,我正在尝试设置一些控制位。
我能够毫无问题地读取i2c上的所有寄存器。但是,如果我尝试写任何控制寄存器没有任何改变。
我还读到我必须通过设置相应的位来启用传感器,这当然对我也不起作用。
传感器设置为单次模式(我想更改),直到我断开并重新连接电源,我总是得到相同的值。
温度值是正确的,如果我用手指加热芯片(并断开/重新连接电源),传感器会改变其读数。
我想我阅读了所有文档,在配置传感器之前我找不到任何神秘的程序...

干杯,
--Jens
#hts221#control-register

以上来自于谷歌翻译


以下为原文




Hi,


I'm using a stm32f469 disco board and a x-nucleo-iks01a1 extension board and I'm trying to set some of the control bits.
I'm able to read all registers over i2c without any problems. But if i try to write any of the control registers nothing is changed.
i also read that i have to enable the sensor by setting the corresponding bit, which of course doesn't work for me either.
The sensor is set to one shot mode (which i want to change) and until i disconnect and reconnect the power supply i always get the same value.
the temp-value is correct and the sensor changes its reading if i wARM the chip up by my finger (and dis-/reconnect the power).
I think i read all documentation and i couldn't find any mysterious procedure to go through before configuring the sensor...

Cheers,
--Jens  
#hts221 #control-register

回帖(6)

李代三

2018-11-5 10:24:27
嗨,
 
你能告诉我你正在使用的设置顺序吗?
 
如果要使用单触发模式,则必须在CTRL_REG1(0x20h)或0x84(启用BDU)中写入0x80,并且为了开始转换,您必须在CTRL_REG2(0x21h)中写入0x01。
 
你使用的奴隶地址是什么?
注意:从地址是BFh用于读I2C事务,BEh用于写I2C事务。
 
问候
安东内拉

以上来自于谷歌翻译


以下为原文





Hi,

Can you send me the sequence of settings that you are using?

If you want to use the one shot mode,you have to write 0x80 in CTRL_REG1 (0x20h) or 0x84 (BDU enabled) and in order to start a conversion you have to write 0x01  in CTRL_REG2(0x21h).
  
What is the slave address that you are using?
Pay attention : the slave address is BFh for Read I2C transactions and BEh for Write I2C transactions.

Regards
Antonella
举报

曹雪

2018-11-5 10:40:31
嗨,
 
 
 我正在使用C#和.net微框架,它完成大部分的i2c通信。
 从地址是0x5F + R / W-bit - >写入事务为0xBE,读取为0xBF。由于我能够读取涉及写入事务的寄存器,这似乎是正确的。
 我用示波器检查了数据,每一点都检查出来。
 
 WHO_AM_I(0Fh)正确回复BCh。
 AV_CONF(10h):1Bh
 CTRL_REG1(20h):0h
 CTRL_REG2(21h):0h
 CTRL_REG3(22h):0h
 STATUS_REG(27h):0h
 
 我首先尝试阅读ctrl_reg,然后写下我的更改,我尝试先写不读。在它检出的总线上,写入传输由从机确认,但没有任何变化。
 我在网上看过一些例子,即使是在不同的编程语言中,但是当我尝试相同的命令序列时,没有任何变化: - /
 
 谢谢你的帮助,
 干杯,
 --Jens

以上来自于谷歌翻译


以下为原文





Hi,


I'm using C# and .net micro framework, which does most of the i2c-communication.  
Slave address is 0x5F + R/W-bit --> 0xBE for a write transaction, and 0xBF for a read. And since i'm able to read the registers which involves a write transaction, this seems to be correct.  
I've checked the data with my oscilloscope and every little bit checks out.

WHO_AM_I (0Fh) replies correctly with BCh.
AV_CONF (10h): 1Bh
CTRL_REG1 (20h): 0h
CTRL_REG2 (21h): 0h
CTRL_REG3 (22h): 0h
STATUS_REG (27h): 0h

I tried reading the ctrl_reg first and then write my changes, I tried writing without reading first. On the bus it checks out, the write transmission is acknowledged by the slave but nothing changes.  
I've seen some examples on the web, even in different programming languages, but when i try the same command sequence nothing changes :-/

Thanks for your help,
Cheers,
--Jens
举报

李代三

2018-11-5 10:54:22
受到警告
提示: 作者被禁止或删除 内容自动屏蔽
举报

曹雪

2018-11-5 11:01:38
嗨,
 
 
 我只有这个例子,所以我不能尝试另一个例子。
编辑:我应该在一周内收到另一个董事会。我会尝试然后告诉你。
 
 干杯,
 --Jens

以上来自于谷歌翻译


以下为原文





Hi,


I only have this one example, so i can't try on another one.
Edit: I should receive another board within a week. I'll try then and tell you about it.

Cheers,
--Jens
举报

更多回帖

发帖
×
20
完善资料,
赚取积分