Hi, everyone here. Recently I get engaged into one project which the lis3dh is used. There are some constraints, so I have to choose the i2c driver instead of spi. And as you can see, I tested the spi driver once and everthing worked well. But when it turns to i2c, I get stuck into the driver for almost one week without making any progress. I read all the posts here about i2c and nothing helps. I only tried to read back the content of WHO I AM register, and used one logic analyzer to monitor the i2c bus, and the result is that no ACK is get responsed from lis3dh after some suggested initialization procedure. So can anybody here help me get out of the deadlock by giving me some advice? For example, should I develop some code to simulate the i2c bus instead?
谢谢。
周一,2015-01-12 07:40
#1
I have been stuck into the i2c driver of lis3dh for almost one week, what should I do
你好夏天20100514!
There are a lot of things you could try.. What have you tried so far? You could double check pin configuration, you could check Chip Select (CS) pin is pulled high on your accelerometer to select I2C bus etc..
一个有趣的事情from datasheet:
因此,检查您的从地址右,0011000或0011001
谢谢for your reply. I have checked what you mentioned above at least 5 times, so I think there must something wrong in the chip or something else? And what's more, is there any demo project or .c file that has been tested before which works well on some chips, for example, adxl345?
不幸的是,我不知道da1458x芯片会有任何。也许你可以分享你的驱动程序的一些代码?
谢谢!
在对话框提供的智能标签的发布项目中,我发现用于一个I2C加速度计的驱动程序文件MC3410,也许会有所帮助。
Hello summer20100514, did you take a look at the i2c EEPROM driver example in teh perhipherals project ? whilst its not a sensor, it is generic i2c command .
BR JE_Dialog
你好夏天2014年,我attach below an example for an SE95 i2c temperature sensor for referebce. The i2c API is fairly robust : we have a couple of customers who are in produciton with i2c MEMS and no reported problems of i2c API .
BR JE_Dialog
sdk ... \ peripheral_examples ... da14580_peripheral_setup.uvproj
step 2. see: periph_setup.h:
将硬件_configuration_index(。)更改为'1'。
/* Test Definition - Select the Configuration that matches your H/W setup
*---------------------------------------------------------
*---------------------------------------------------------
*/
//
#定义HARDWARE_CONFIGURATION_INDEX (1) // 1 => I2C
step 3.
add new software in: eeprom_test.c (at the beginning of the file)
挥发性int16_t温度;
volatile int ii;
// testing peripheral SE95 temperature sensor
//地址= 1001 a2 a1 a0 r / w => 7bitaddress = 0x48 ... 0x48 + 7 = 0x4f
i2c_eeprom_init(0x48, I2C_STANDARD, I2C_7BIT_ADDR, I2C_1BYTE_ADDR);
// reading internal ID-number:
ii = i2c_eeprom_read_byte(0x05); // test reading ID-value = 0xA1
// reading temperature
btrd = i2c_eeprom_read_data(rd_data, 0, 2);
temperature = 256 * rd_data[0]+ rd_data[1];
temperature = temperature / 8; // shift 3 bits to right
@BR JE_Dialog, thanks for your attention and patience.
Hey Summer20100514,
Is your problem solved , i am facing the same problem with adxl345 , i have tried the eeprom example code it gets stuck at
wait_for_received_byte()?
谢谢
您应该先检查上拉电阻和从机地址,您应该更好地使用逻辑分析仪。祝你好运
i am using 4.7k pullups for lis3dh but it's not working for me (got adxl working by the way thanks !!) . what pullup resister are you using , also if SDO is grounded 7-bit slave address is 0x18 ( as we are excluding the read write bits) ?
是的,还有一些东西confuses me. My colleague is working on this, and he said to me he added some delay between i2c functions and it seemed working well, so you can try this. And if you make any progress, please be kind to post here for references, thanks.
任何一个人都得到了这个问题的解决方案.........因为我也得到了同样的问题,我的代码也被困在ptri2c-> getstatus()的无限循环中。
我也得到了相同的problem ...my code is also stuck in infinite loop at "ptrI2C->GetStatus().busy" .........what is the solution of this problem? if any body solve this problem then please tell the solution.thanks in advance.