Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
2,179 Views

Running DS1307 RTC over an Intel Edison on Sparkfun blocks

Jump to solution

My project is based on Sparkfun's Edison breakout blocks, and I need to get the DS1307 RTC speaking to it via the I2C Block. I've not found any guides specifically for Edison here, but found a http://www.switchdoc.com/2014/07/python-driver-ds1307-real-time-clock/ Raspberry tutorial (with https://github.com/switchdoclabs/RTC_SDL_DS1307 library in github) that looks usable or adaptable. I've connected the DS1307's SDA/SCL pins to the I2C block, its GND/5V pins to a 5V power supply, and I2C block's GND to the 5V supply ground. Next I installed the SMbus library with `opkg install python-smbus`, and cloned the Raspberry library and called the test script:

root@edison:~/rtc/RTC_SDL_DS1307# python testSDL_DS1307.py Test SDL_DS1307 Version 1.0 - SwitchDoc Labs Program Started at:2016-01-18 17:22:29 [ 1650.236006] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration Traceback (most recent call last): File "testSDL_DS1307.py", line 35, in ds1307.write_now() File "/home/root/rtc/RTC_SDL_DS1307/SDL_DS1307.py", line 200, in write_now self.write_datetime(datetime.now()) File "/home/root/rtc/RTC_SDL_DS1307/SDL_DS1307.py", line 194, in write_datetime dt.isoweekday(), dt.day, dt.month, dt.year % 100) File "/home/root/rtc/RTC_SDL_DS1307/SDL_DS1307.py", line 157, in write_all self._write(self._REG_SECONDS, _int_to_bcd(seconds)) File "/home/root/rtc/RTC_SDL_DS1307/SDL_DS1307.py", line 83, in _write self._bus.write_byte_data(self._addr, register, data) IOError: [Errno 11] Resource temporarily unavailable

The script fails on the second of these lines:

ds1307 = SDL_DS1307.SDL_DS1307(1, 0x68) ds1307.write_now()

Not sure why it fails. Very grateful for assistance. The following calls will help explain what's going on on the I2C bus.

root@edison:~/rtc/RTC_SDL_DS1307# i2cdetect -y -r 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- root@edison:~/rtc/RTC_SDL_DS1307# i2cdump 1 0x68 w WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-1, address 0x68, mode word Continue? [Y/n] Y 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f [ 830.245731] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration 00: XXXX ff1f XXXX XXXX XXXX XXXX XXXX XXXX [ 830.253809] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.254463] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.259504] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.266452] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.267940] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.272002] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.272209] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.272410] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.280218] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.286532] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.289284] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.290893] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.299010] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration [ 830.305487] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration 08: XXXX ff4f XXXX XXXX XXXX XXXX XXXX XXXX 10: ff6f XXXX XXXX XXXX XXXX XXXX XXXX XXXX 18: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 20: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 28: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 30: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 38: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 40: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 48: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 50: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 58: ff0f XXXX XXXX XXXX XXXX XXXX ff83 XXXX 60: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 68: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 70: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 78: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 80: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 88: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 90: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 98: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX a0: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX a8: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX b0: XXXX XXXX XXXX XXXX XXXX XXXX ff1b XXXX b8: ff0f ff43 XXXX XXXX XXXX XXXX XXXX XXXX c0: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX c8: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX d0: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX d8: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX e0: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX e8: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX f0: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX f8: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX

 


Accepted Solutions
Highlighted
New Contributor I
18 Views

Problem solved in this case by:

- extending the circuit to include the Sparkfun Fuel Gauge, and

- de-soldering the RTC's ST2 jumper that connects to the pull-up resistor (since the Fuel Gauge features this),

- cutting the jumper to 3.3V on the I2C block - https://cdn.sparkfun.com/assets/learn_tutorials/3/1/1/5Vhack.png https://cdn.sparkfun.com/assets/learn_tutorials/3/1/1/5Vhack.png

Now the RTC Module responds for voltages above 4V.

View solution in original post

0 Kudos
7 Replies
Highlighted
New Contributor III
18 Views

I²C in the Edison is 1.8V. You need a level translator.

The Edison has a built-in RTC. It just needs a battery connected to the V_VBAT_BKUP pin. I think it should be >= 2.7V and <= 3.3V.

 

0 Kudos
Highlighted
New Contributor I
18 Views

Hi Vincenze. The RTC is running on an independent 5V supply. And like I say I'm using Sparkfun Blocks - unfortunately none of these provide access to the V_VBAT_BKUP pin or that would certainly be the best solution..

0 Kudos
Highlighted
Employee
18 Views

This might be related to the voltage values needed by the shield and given by your board. The Arduino expansion board's I/O can be set to 3.3V or 5V depending on J9. In what position do you have J9? Is there any chance you can connect a logic analyzer to the shield's power and data signals to see if the signal is not being distorted?

Sergio

0 Kudos
Highlighted
New Contributor I
18 Views

Hi Alvarado - what do the Sparkfun blocks have to do with Arduino? Am I missing something? https://www.sparkfun.com/categories/272 Intel® Edison - SparkFun Electronics

0 Kudos
Highlighted
New Contributor III
18 Views

Just make a board for an RTC chip that works at 1.8V. There are many.

I quickly googled:

http://ww1.microchip.com/downloads/en/DeviceDoc/25010A.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/25010A.pdf

http://www.nxp.com/documents/data_sheet/PCF85063A.pdf http://www.nxp.com/documents/data_sheet/PCF85063A.pdf

Or use an I²C level translator chip 1.8V<->5V. You need an open-drain level translator. There are also many.

0 Kudos
Highlighted
New Contributor I
19 Views

Problem solved in this case by:

- extending the circuit to include the Sparkfun Fuel Gauge, and

- de-soldering the RTC's ST2 jumper that connects to the pull-up resistor (since the Fuel Gauge features this),

- cutting the jumper to 3.3V on the I2C block - https://cdn.sparkfun.com/assets/learn_tutorials/3/1/1/5Vhack.png https://cdn.sparkfun.com/assets/learn_tutorials/3/1/1/5Vhack.png

Now the RTC Module responds for voltages above 4V.

View solution in original post

0 Kudos
Highlighted
New Contributor I
18 Views

Thanks Vincenze, your comment made us review the configuration and spotted we needed to adapt the RTC as I've described. So thank you

0 Kudos