ESP8266 communication with ds3231 RTC on i2c

mojhggn
Posts: 3
Joined: Tue Jun 23, 2015 1:32 am

ESP8266 communication with ds3231 RTC on i2c

Postby mojhggn » Wed Jul 22, 2015 10:22 am

Thanks to generous and helpful online community, I have finally learned to talk to esp8266 in c.
Most of the learning is by way of copy pasting others' code shamelessly.
For last three days, I am trying to get ds3231 talk to esp8266.
I am coding on OsX 10.9, gcc toolchain, espressif SDK 1.2.0.
Using Richard Burton's exquisite driver for ds3231 and espressif's i2c_master driver, I initialised i2c_master_gpio_init in my user_init.
I am using gpio4 (SCL) and gpio5 (SDA) on esp-07, considering silk-mask on module has swapped 4<->5 (confirmed by lua code).
The output I get from getTime (hh:mm:ss, dd-mm-yy) is strange..-> command 6 - RTC

-> command 6 - RTC
-> Time: 37:165:93, 165-24-265
-> command 6 - RTC
-> Time: 37:165:93, 165-24-265
-> command 6 - RTC
-> Time: 37:165:93, 165-24-265
-> command 6 - RTC
-> Time: 37:165:105, 165-24-265
-> command 6 - RTC
-> Time: 37:165:43, 165-24-265
-> command 6 - RTC
-> Time: 37:165:41, 165-24-265

I have confirmed time setting and getting in lua code using same pins on the module-it works like charm.

Can anyone help me in solving the problem.

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

Re: ESP8266 communication with ds3231 RTC on i2c

Postby costaud » Tue Jul 28, 2015 4:19 pm

Hi , can you capture the waveform of IIC bus?
Make sure there is an external pull-up resister or set a pull-up register inside.

eriksl
Posts: 155
Joined: Fri May 22, 2015 6:22 pm

Re: ESP8266 communication with ds3231 RTC on i2c

Postby eriksl » Sat Aug 01, 2015 2:13 am

If there's something wrong with the i2c bus (hardware) it should be detectable. Missing pull ups, gpio's that are not in open drain mode (but push-pull), swapped scl and sda, they all give situations the i2c software can detect. My implementation does. When an implementation sets sda or scl it should check if it's really up or down, every output is always also an input. I know the espressif example code doesn't... You might want to try to get it to work with my universal i/o bridge, using raw i2c commands.

Who is online

Users browsing this forum: No registered users and 9 guests