I2C Bus Hardware question?

Everything relating to hacking, expanding and modifying the Joggler hardware.
Post Reply
User avatar
pete
Posts: 2515
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

I2C Bus Hardware question?

Post by pete » Thu Jan 14, 2016 4:08 pm

Can I connect a battery backed up RTC to the SCL/SDA pins on the ICS UMS9001 clock chip U13?

IE: Pin 5 is SDA (data) and pin 6 is SCL (clock)

Image

Image
rtc.gif
- Pete

Auto mater

Juggler
Posts: 234
Joined: Thu Apr 21, 2011 2:34 am

Re: I2C Bus Hardware question?

Post by Juggler » Mon Jan 18, 2016 6:28 am

The website you got some the pictures from (http://www.sunspot.co.uk/Projects/Joggler/i2c.html) appears to indicate having some success on connecting an i2c slave device to the Joggler's PCB near to the SILABS F311 chip.

Appears that getting the right voltages has been an issue for sunspot.

If I was going to do this, I'd read the datasheets for the chips, look at what is going on with probes attached to the points I'd solder to on the Joggler's board using a logic analyser (or something that would let me see what is happening on those lines), use same logic analyser or similar device and look at what happens from the i2c RTC lines intended to connect to the Joggler. If all was ok then, to be super safe you could connect the i2c RTC to the Joggler with some safety circuitry in between - exactly whether this is necessary and what this should be I am not certain. Then use the i2c software to see if you can get data from the RTC module. You will need to understand how the RTC module holds the time data and if this is compatible with the way the Joggler's i2c communicates with the RTC and if the Joggler can retrieve the data.

Sunspot claims to have had success pushing data to a PIC attached to the Jogglers i2c bus :
Drive an external PIC16F877A using just i2cset and i2cdetect on the Joggler - a test example

The PIC has an array buffer[0x10] and i2cset can load values into it by sending the array element number followed by the value
The circuit is like the left hand circuit at the bottom of this page

e.g. i2cset -y 0 80 0 2 b sends to i2c bus 0 at address decimal 80 and places a value 2 in the array element buffer[0]
In this test pin DO is wired to an LED (then to resistor to ground - so LED on = high )

buffer[0] . . . Set the mode of action. If it is 1 then the LED flashes and if it is 0 the LED is on or off
buffer[1] . . . For the flashing mode 200 means set pin D0 high for 200 milliseconds
buffer[2] . . . For the flashing mode 200 means set pin D0 low for 200 milliseconds
buffer[3] . . . For the on or off mode, 1 means ON, 0 means OFF
If the hardware works well together, it will still be necessary to read the time from the RTC module at boot time and at specific intervals to update and keep the Joggler's infamously drifting clock, more or less accurate.

I recently bought some slightly different time modules, with the same intention as you have.

DCF-Empfangsmodul DCF1 - Bausätze / Module - Module - - Pollin Electronic
http://www.pollin.de/shop/dt/NTQ5OTgxOT ... _DCF1.html

Pollin DCF77 module
http://www.mathias-wilhelm.de/arduino/p ... eh21dmbma2

Arduino DCF77 radio clock receiver – Hardware | Thijs.Elenbaas.net
http://thijs.elenbaas.net/2012/04/ardui ... ardware-2/

I think the best thing to do is to check if you could damage either the Joggler or the RTC and if this is unlikely, just go ahead and tinker. Sunspot's work seems to be the main work on the net for connecting to the Joggler's i2c bus. This was done some time ago and, sadly, appears to have been abandoned.

PS
I bought a Saleae Logic Analyser clone very cheaply from AliExpress (around $10 delivered). The clones will work with the Saleae sofware up to a certain version, but it is also possible to use the latest Open Source SigRok analyser software with the clones as well. The analyser software should have a module that understands the i2c protocol.

User avatar
pete
Posts: 2515
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: I2C Bus Hardware question?

Post by pete » Mon Jan 18, 2016 9:53 pm

Thank you Juggler.

Yup the only reason I was thinking of the RTC device pictured is that I used that one for a microrouter openwrt project doing a bit of bit banging and soldered a 1-wire temperature sensor to the RTC board.

and I have done similiar with the RPi2 (well two of them now).

With the NIC rom and the RTC then the Joggler will be much closer to a regular computer. I am currently using many of them as touch interfaces to my automation mothership.

I do manage them via name, MAC and IP via the mothership today.

I am trying to short cut this a bit and making many assumptions.

There is a little lithium battery on the Openpeak 2 devices and I have no ideal if there is a charging circuit and where the battery goes to. It does work though as when I read the hardware clock I see the actual time with no network connection configured.

I see some stuff with stock build. Guessing if I just add the RTC clock I may see something using i2cdetect without doing much; then from there and the addresses just go to the bit banging part of it.

I have not really ever played with a logic analyzer but did get in to ham radio stuff in the 1960's and building stuff back then. Getting 5VDC from the board shouldn't be an issue and the 1-wire temperature sensor would just be an add. The Openframe device uses a massive metal heatsink in it so I really don't need to watch the temperatures.

root@ICS-Ubuntu-Buzz:~# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
If the hardware works well together, it will still be necessary to read the time from the RTC module at boot time and at specific intervals to update and keep the Joggler's infamously drifting clock, more or less accurate.

Well here I was going to just do some bit banging at boot if it works similiar to what I did with my openwrt microrouter. There just tapped a couple of free GPIO ports though.

Here is how I am starting the openwrt microrouter to read the RTC clock.

root@ICS-GLiNet:~# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@ICS-GLiNet:~#

UU is at 0X68

echo ds1307 0x68 > /sys/bus/i2c/devices/i2c-0/new_device
if hwclock | grep 'Jan' | grep -q 2000 ; then
logger "RTC appears to have a flat battery..."
else
logger "RTC set hwclock"
hwclock -s



So it looks like you are using a radio receiver for your time sync eh?

Here all of the clocks on the walls in the house use radio to sync time. They work OK though not great as here in Chicago I am getting time sync from Colorado. I do have a GPS with PPS connected to my PFSense Firewall and that works pretty good.
gps-pfsense.jpg
- Pete

Auto mater

Juggler
Posts: 234
Joined: Thu Apr 21, 2011 2:34 am

Re: I2C Bus Hardware question?

Post by Juggler » Mon Jan 18, 2016 11:09 pm

Very interesting and good work...

So with your RTC module attached to the i2c bus on the Joggler, do the values your reading at addresses 0x18, 0x34, 0x4c and 0x69 have some meaning and are, sort of, what you would expect ? Two are the value of the address being read and the other two 'UU' are maybe some default value. Do you have the datasheets for the chips on the RTC board ? Are these chips programmable ?

I haven't done anything yet with the atomic clock modules. I think I'll try with an arduino first. But it would be good to have one directly in the Joggler. I could mount the ferrite rod on the top. Reminds me of the Long Wave and Medium Wave radio days, and tinkering with old transistor radios.

Would recommend getting one of the cheap logic analysers. For the price you can hardly go wrong and it is always nice to have some cool test equipment. Most of the work is done in the software and the small match box sized device just provides a simple interface between what is under test and a USB interface. The one I have is actually just a small single System on a Chip (SoC). It's a clone. The genuine article costs over $100, I think.

Juggler
Posts: 234
Joined: Thu Apr 21, 2011 2:34 am

Re: I2C Bus Hardware question?

Post by Juggler » Mon Jan 18, 2016 11:17 pm

Quick search :

Real Time Clock Module | Hobbyist.co.nz
http://www.hobbyist.co.nz/?q=real_time_clock
Understanding the Code | DS1307 Real Time Clock Breakout Board Kit | Adafruit Learning System
https://learn.adafruit.com/ds1307-real- ... g-the-code
"Tiny RTC I2C Module" issue
https://forum.arduino.cc/index.php?topic=177297.0

are these yours ?

One of these talks to the RTC module via a terminal. Maybe it is possible to set up a terminal on the i2c bus ? There is some code in the above links to.

Will have a better read about the Tiny i2c RTC module later, I think...

User avatar
pete
Posts: 2515
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: I2C Bus Hardware question?

Post by pete » Mon Jan 18, 2016 11:26 pm

are these yours ?

First link is.

I dunno yet and just ordered one for the Joggler on Amazon. They are more expensive there but I get them in 2 days.

I am testing blindly and guessing I will see a new value show up when I look at the i2c bus. Another way to do this is to purchase one of those mini USB with RTC devices. They are tiny and would also fit inside of the joggler.

Do you have a link to the logic analyzer. Is it from Seed Studio?
- Pete

Auto mater

Juggler
Posts: 234
Joined: Thu Apr 21, 2011 2:34 am

Re: I2C Bus Hardware question?

Post by Juggler » Tue Jan 19, 2016 12:09 am

This is the original :

https://www.saleae.com/

but I bought a clone from AliExpress for less than $10. If your buying a clone you need to get some probes too, more then likely and there is quite a range to choose from.

You might like to have a look at this :

https://hallard.me/cheap-and-usefull-logic-analyzer/

should give you an idea of things.

User avatar
pete
Posts: 2515
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: I2C Bus Hardware question?

Post by pete » Tue Jan 19, 2016 1:33 am

Found this one for a bit more at $16.
logic.gif
Guessing too that you could just build a USB to I2C to RTC and fit it inside of the Joggler running XP eh?
- Pete

Auto mater

Juggler
Posts: 234
Joined: Thu Apr 21, 2011 2:34 am

Re: I2C Bus Hardware question?

Post by Juggler » Tue Jan 19, 2016 4:27 am

Yep thats the kind.

Did a search on ali and found this for $5 :

http://www.aliexpress.com/item/1sets-Ne ... 89296.html

You need some probes/test clips to go with this. How about 10 for $1 :

http://www.aliexpress.com/item/10pcs-Te ... 90956.html

So then your good to go for $6 all in !

All you need is the Saleae logic 1.1.15 (I think this is the latest version that will work with clones) software or SigRok.

You can even install on a Joggler.

Gee they just get cheaper...

User avatar
pete
Posts: 2515
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: I2C Bus Hardware question?

Post by pete » Tue Jan 19, 2016 5:28 am

Thanks Juggler.

Yup; ordered the RTC first to see what happens.
- Pete

Auto mater

Post Reply