I'm trying to get the da14580 to connect to a HP203b pressure sensor. I have tested this sensor on a Raspberry Pi and it works fine. On the da14580 the timing seems to be too fast. I can see the signal gets sent but the pressure sensor doesn't respond. This is running at normal speed. When I look at the wave form in a Logic Analyzer, the Pi connection SCL is low for 10 uSeconds then high for 10 uSeconds as expected. With the dialog chip, it is low for 6 uSeconds and high for 4.5 u Seconds. (I am guessing that is actaully 5 and 5, with some error from my sampling speed)
Why would the SCL rate be twice as fast coming from the da14580 chip. What can I do to fix this?
Thank you
John
Device:
Hi johncharris,
Can you please provide me the initialization cod snippet of the I2C peripheral block? In addition, if you were able to share me wave forms from the logic Analyzer, it would be very helpful.
Thanks, PM_Dialog
Here is the code. I have the full I2C c file I'm using in the attached zip. I have a screenshot of the logic analyzer with a working implementation on a Raspberry Pi and another screenshot of the non working waveform from the da14580.
Thank you,
John
Hi John,
Let me check your inputs and I will get back to you as soon as possible.
Thanks, PM_Dialog
Thank you,
John
Hi John,
The I2C block can operate in two modes: either in Normal or in Fast mode. The I2C_SPEED bitfield of the I2C_CON_REG register controls at which speed the controller operates.
根据你的初始化代码,标准的密苏里州de in used, so the speed will be at 100 kbit/s, as you can see in the logic analyzer wave form. I tested it in my side and in standard mode the SCL is at 1(high) for 4.908 usec and in 0(low) for 5.092usec, which means 10usec period time. In your case you need 20usec (10usec at high, 10usec at low) which is translated to 50 kbit/s. This is not possible to be achieved as the minimum speed for I2C block is at 100 kbit/s.
Since there is no generic i2c driver in order to create you own sensor driver implementation, I would suggest you to have as reference the I2C example of the SDK which is located under 5.0.4\projects\target_apps\peripheral_examples\i2c\i2c_eeprom path. For example, check the i2c_eeprom_init() function.
Thanks, PM_Dialog