Shop OBEX P1 Docs P2 Docs Learn Events
Need help with penguin real time clock — Parallax Forums

Need help with penguin real time clock

bee_manbee_man Posts: 109
edited 2011-02-28 17:02 in Robotics
I am trying to interface a DS1307 RTC with one of the new improved REV B fixed penguins. The problem is the I2C bus does not appear to be happy when I piggyback the RTC and the 24FC128 EEPROM. The penguin works perfectly both before and after I remove the RTC. Likewise the DS1307 works perfectly both before and after the piggyback. I tried to tie SCL high with both a 10K and 4K7 resistor with no improvement. (The RTC usually requires SCL tied high apparently not the EEPROM)

The problem is after I piggyback the RTC to the 24FC128 the main board can not access the EEPROM. The boards LED powers on, the 7 segment display is totally on (8 & dp), but I am not able to load a program with the Basic Stamp Editor.

I have added DS1307 RTC's to a BOE BOT, SumoBot, and a propeller with no problem, so I'm sure it is something simple that I am overlooking.

Any suggestions.

Comments

  • bee_manbee_man Posts: 109
    edited 2011-02-24 07:31
    Humanoido I have seen both those links in my search for a solution, this is not a software problem, once i attach the two chips the penguin is locked up. It is definitely a hardware problem. Both devices work perfectly both before and after I separate them. They just don't work when I hook them together on the I2C bus. This should not be to complicated, but I have tried various resistor combinations to no avail. The clock chip I have used alot successfully so I think it is some thing with the penguin EEPROM.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-24 16:13
    You are saying you piggybacked the RTC and the eeprom? Or the RTC has a conflict with the existing eeprom? Please provide a schematic drawing of your wiring.
  • bee_manbee_man Posts: 109
    edited 2011-02-24 21:11
    I piggy backed the RTC on the EEPROM, I don't have a schematic but it is very simple. The RTC and the EEPROM share 4 pins. 4 GND, 5 SDA, 6 SCL, and 8 Vdd. The DS1307 needs a crysal on pins 1 & 2, and the backup battery on pin 3. The way I do it is to bend pins 4,5,6,&8 down on the RTC it then fits perfectly on the EEPROM and those pins are easily soldered. Then just solder on the crystal and battery lead. The EEPROM and RTC have different addresses so they should share the I2C bus with no problem. The RTC usually needs both I2C lines pulled high and I tried adding a resisitor to SCL.

    When I do piggy back the chips the I2C bus seems to lock up. I know the MSOP version of the 24FC128 only uses one address line instead of the normal 3, but they should still be on different addresses. The RTC is 1101000 and the EEPROM 1010000.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-24 22:04
    As I understand, you added an extra eeprom. I suggest troubleshooting to get this eeprom reading and writing first before adding the RTC.
  • bee_manbee_man Posts: 109
    edited 2011-02-24 22:11
    No just the existing EEPROM.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-25 00:36
    I think you should post the code and a wiring diagram for troubleshooting because the BS2 and the BS2px are different.
  • bee_manbee_man Posts: 109
    edited 2011-02-25 14:53
    Here is the schematic for the RTC.

    penguin RTC.jpg
    1024 x 389 - 30K
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-26 00:21
    Bee_man, thank you, I see that Chris has updated his RTC information here.
    http://forums.parallax.com/index.php
    Chris says, "The demo is also running on a BS2, but you could use any BASIC Stamp Microcontroller you want."
    Maybe this information will help.
    http://forums.parallax.com/showthread.php?77867

    Also attached is a Penguin REVB schematic showing the 24 WC 128 J EEPROM. Note R1 and R16 that affect SDA. Vdd is on pin 8.

    attachment.php?attachmentid=78706&d=1298736244
    403 x 324 - 33K
  • Martin_HMartin_H Posts: 4,051
    edited 2011-02-26 12:42
    What I don't understand is how you plan to address the RTC from PBASIC. I looked at the 2PX I2C instructions and it looked like you needed to use the standard pins. One of the samples linked also looked like they were using regular I/O pins.

    The EEPROM is access by the microcontroller running the PBasic interpreter to load tokens. I haven't seen the I2C bus used by the underlying hardware used directly from PBasic.

    In addition I read the docs for I2CIN and it only allows you to specify the SDA pin. The SCL pin is SDA+1. The penguin's free pins are 5 and 11. So to use I2C you'll have to bit bang the protocol. That's OK as there is code out there to do that.
  • bee_manbee_man Posts: 109
    edited 2011-02-26 19:07
    Martin_H

    I'll try to clarify my question, I want to get the RTC onto the I2C bus and not use the only 2 available pins. It is very easy to bit bang the protocol, I think that's why there is confusion with this question.
    I don't want to just get a real time clock going.

    That said the problem is that the DS1307 and the EEPROM don't seem to work together like they should. I can not even begin to worry about the software needed because as soon as the 2 chips are connected the bus locks and you can not even load software.

    Whats the point of an I2C bus if you can not use all 128 devices. You maybe right and I won't have any way to get to the RTC in PBasic. I will need to be able to access RA0 and RA1. I'll worry about software after I get the hardware working.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-02-26 19:30
    OK, so my impression that you are trying to use the EEPROM I2C bus was correct. I strongly suspect that won't work as PBasic abstracts the underlying hardware and I don't see a way you can access to that bus from the PBasic interpreter. I don't know why it is locking up, maybe someone from Parallax could chime in.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-26 20:16
    Ok, so the problem happens on both Penguins? The I2C bus system definitely works, the BS2px has specific commands for it, so there could be some problem in the Penguins pre-existing connection. You said it was piggyback. I think you need to sketch it and see what connections go where in the real world, to know what's happening. Did you use this RTC chip after trying it on Penguin? Just make sure it's not shorting out and it's still functional. So if you boot up Penguin, then add the RTC, does it work? If it still does not work, this is a question that someone like David Carrier at Parallax should answer.
  • bee_manbee_man Posts: 109
    edited 2011-02-26 20:18
    I was just looking over the PBasic code and I think you are right. I don't see a way to access RA0 and RA1 which are the two address lines needed to acess the I2C bus. I saw one mention of the other 16 available pins on the 2px but no way to use them. I don't know of a way to include any assembly or new instructions like with a DATA command. It would be nice to be able to modify the WRITE command to use the clock I2C address instead of the EEPROM. Back to the propeller I guess.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-26 20:25
    I was reading up on this again and indeed you would need to use the two existing Penguin pins to establish the I2C bus, and not RA0 and RA1. Then you could get started in connecting numerous devices and software will be compatible. The RA0 and RA1 are special case processor lines that are not on user programmable pins. You should have every reason for utilizing the two existing pins, i.e. not giving up on this project. The two pins are free and clear. The BS2px boot from eeprom will work fine, you'll get your I2C bus and everything will work. Plus, you could attach another eeprom, or as many as you want up to 128 in theory. Is there a reason you do not want to use Penguin's standard two available pins?
  • bee_manbee_man Posts: 109
    edited 2011-02-26 20:29
    Both chips work except when connected together. Both before and after. I even had the clock running on the two I/O pins by bit banging the RTC. I think Martin_H is right and even if I can get the two chips working together I won't have any way in PBasic to talk to the clock. To bad I thought it would be cool to get this working. I'm working on a propeller board for my sons BoeBot so I don't really have time to play around with this any more. I did not think it would be this difficult.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-26 20:49
    bee_man wrote: »
    I even had the clock running on the two I/O pins by bit banging the RTC.
    Why not use this method?
  • bee_manbee_man Posts: 109
    edited 2011-02-27 06:15
    No fun, already been done, fully documented, average, the other way would have been very cool!
    The chip and crystal piggy backed took up no extra space and not even an external wire. Plus, if you have an I2C bus up and running why run two, unless you have 256 peripherials.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-28 17:02
    bee_man wrote: »
    No fun, already been done, fully documented, average, the other way would have been very cool!
    The chip and crystal piggy backed took up no extra space and not even an external wire. Plus, if you have an I2C bus up and running why run two, unless you have 256 peripherials.
    Well now you got me really curious! Ok, if you want something cool there are some options but you have to put in some work to make it happen. I asked the question in this thread and Mike Green replied.

    http://forums.parallax.com/showthread.php?129971-Programming-BS2px-with-SCL-amp-SDA-Lines&p=980851#post980851

    It's probably not the simple conclusion you're looking for, i.e. merely piggyback an I2C device on the eeprom and access through PBASIC. However, Mike describes some options which could be followed if you want to do some development. It could be a very good learning experience!
Sign In or Register to comment.