7 Replies Latest reply on Jan 19, 2016 9:08 AM by geotheory

    Running DS1307 RTC over an Intel Edison on Sparkfun blocks

    geotheory

      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 Raspberry tutorial (with 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