Shop OBEX P1 Docs P2 Docs Learn Events
DS1307_v2008.SXB external clock problem — Parallax Forums

DS1307_v2008.SXB external clock problem

CapdiamontCapdiamont Posts: 218
edited 2008-10-24 05:03 in General Discussion
Nothing has me more excited than to see

"Friday
October 10, 2008
22:49:03 PM
Friday
October 10, 2008
22:49:04 PM"

etc.

This will be for water timer, etc. I'm using a ds1307 mini module and 5v rs232 mini module. The code is mostly the same, but I'm having a few qwerks, I'm not sure why.
SX48 proto board with 50mhz resonator that came with the the latest programming package. It says 500? on it.



DEVICE          SX48, OSCHS2 'HS1 ', TURBO, STACKX, OPTIONX 'XT2 4mhz
FREQ            50_000_000

Baud        CON    "T9600"

  'PUT time, $00, $30, $22, Fri, $10, Oct, $08, 0
  'SET_CLOCK




I commented out the put time stuff because the time has been set now

The problems are a) it doesn't display civilian time, not a big deal, but I don't think I did anything to make it fail. b) it stops out putting to the serial port after a little bit. I can't get it to start again until after I do another program. Turning it off and on doesn't do it.



Thanks Jon Williams for the code!!!!!!!!!!!!!!!!!!!!!!!!!!!

Post Edited (Capdiamont) : 10/24/2008 4:51:03 AM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2008-10-11 12:31
    Try using HS1 instead of HS2 (if you haven't tried that already).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-11 16:59
    The civ time problem is that it doesn't subtract 12h when it is 13+ hours.

    HS1 doesn't seem to start it at all. HS2 will start it after programing(ctrl+p) but if I turn it off, it doesn't seem to start up. I assume it should start work and output quicker than doing a program after turning it on.
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-11 18:00
    I'm thinking adding
    IF tmpB1 > 12 THEN
         tmpB1 = tmpB1 - 12
      ENDIF                                        'convert hours to civ time
    
    


    will make the civ hours right. Will see after 1 or so.

    I have my resonator in the x2 socket, reading online, that should be right. Do I need to add any resistors/capacitors to make it work with out the sxkey? I'm thinking no, I shouldn't have to. Maybe programming adds a little kick? Or is there stray capacitance/Resistance added by the key that makes it work?
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-11 19:54
    grumble, move it to another pc that has built in serial port and winxp vs vista to see if I have a windows comm problem.

    I lost the resonator!!!!!!!!

    I tried the other resonator which should be 4mhz, says 400cm812 on it. so I set the freq to 4_000_000 and tried the various XT2, HS1, and HS2 yet no serial out.

    I tried run(ctrl+r) at 4mhz and 50mhz but either no serial out, or buggy.

    Would radio shack have a resonator that would work, in stock?

    I know when I bought the kit I bought extra resonators, but can't find them.
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-11 22:20
    I ordered today 5 each 4mhz, 20mhz, and 50mhz 3 pin dip from parallax.

    Why doesn't the 4mhz one work, that I got with the programming kit?
  • BeanBean Posts: 8,129
    edited 2008-10-12 02:44
    Did you change the DEVICE parameter to OSCXT1 ?

    Different resonators require different drive levels.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-12 03:33
    i didn't try that one. So I just tried it. XT1, XT2, HS1, HS2 doesn't give me any serial output. That is a 4mhz right? 400cm812 on it. I set freq to 4_000_000.

    Is it ok to use some electrical tape to hold those resonators down, to prevent losing them?
  • Shawn LoweShawn Lowe Posts: 635
    edited 2008-10-13 14:16
    I am sure, electrical tape could only make it look like it doesn't work! [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-16 05:32
    ok, received resonators today. I had screwed the proto board and mini modules down in the downtime on a small board. I got erratic behavior. So i ended up placing all the PCB's close as possible, and shortened all the wires short as possible. I'm not sure why I had the problem with the wires, because they were the same size as before. So it is now back to where it was, stopping serial output after a short bit.

    Great news though my code modification to the civilian hour display above, works great.

    My ideas are a) hook up serial out to different computer b) add flashing led as heart beat for the SX. c) try the code on the sx tech board, to give me both new sx and board to try. d) I monitor PS. E)I have no idea.
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-17 05:00
    I'm feeling incompetent here. I don't understand why I'm having so many problems. Yet I don't hear anybody having so many problems.

    I tried hoking it up to my desktop with built in serial port, and get no serial out. I know I'm on the right comm port of that computer, by looping back the tx/rx pins, I can see what I type. I still using my laptop to program it. That may cause a problem, I don't know. it is winXP com1, 9600(using T9600 on sx) 8,N,1 no flow control

    My normal way is to program and read the serial port from the laptop(win vista). Programming i use the USB key, for the serial port I use the Parallax USB to serial(232)

    So a short recap. Currently using OSCHS2. It will not boot up without it being HS2, even with this new resonator. However after a short bit, it will stop outputting serial.

    I put in TOGGLE HBLED right after GET_CLOCK in Main:. HBLED is RB.0. It stops toggling when it stops serial out.

    The power supply can supply 3.5A

    VSS to VDD voltage is 4.94v

    ground to XO on the X1 clock connection gives 169.2mv. ground to xI gives 4.94v

    during programming Xo gives about 1.3v xI gives about 11.86v. Measuring voltage during programming doesn't allow it to boot, no serial out.

    OK, I've replaced the resonator with another new one. It is running for a good bit after programming, but still stops, and will not start without being programmed.
  • ZootZoot Posts: 2,227
    edited 2008-10-17 09:31
    Post the actual code you programmed into the SX.

    Post a schematic or sketch if you can.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-18 03:01
    TTL_5V_RS232.jpg
    is the rs232 mini module www.futurlec.com/Mini_RS232_TTL_5V.shtml

    ET-MINI_DS1307.jpg
    is the 1307 mini module www.futurlec.com/Mini_DS1307.shtml

    code is attached(I think).

    Tomorrow I'll take a photograph of the setup

    VDD from sx48 proto board goes to VCC on both mini modules
    VSS from sx48 proto board goes to GND on both mini modules
    RA.0 goes to TX0 of RS232 mini module
    RA.1 goes to RX0 of RS232 mini module
    RA.2 goes to SDA of 1307 mini module
    RA.3 goes to SCL of 1307 mini module
    RB.0 doesn't go to to anything, I monitored it using a multimeter.

    RS232 mini module
    TX1 is tied to RX1, makes it nice, just have to move the cable from port 0 of max232 to port 1 to do a loopback test.
    TXD goes to Pin2 of 9 pin
    RXD goes to Pin3 of 9 pin

    The jumpers for the resistors on the 1307mini module is set to on(ENA)
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-19 00:34
    Thoughts. MCLR and RTCC pins are not tied anywhere. I'll have to tie them to vdd. 4.7k This could be one of my problems here.

    Could I be frying the resonators by programming with them in?

    Looking though sxlist.com, someone had to add 4.?v brownout protection because the PS didn't come up fast enough. Maybe?

    We will see how well the photo upload goes.
    2492 x 1252 - 1M
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-19 05:21
    OK,tied MCLR and RTCC pins each through their own 4.7k resistor. no help

    adding BOR42(brownout 4.2v) to the device line didn't help.

    Still stopping serial out after a little bit.

    1st try at making the sx tech board work, didn't.
  • ZootZoot Posts: 2,227
    edited 2008-10-19 13:50
    Besides possible code issues, I suggest reading some documentation before trying out random solutions, to wit:

    - on the protoboards, /MCLR is already tied to Vdd through a 10k resistor (see the schematic for the boards at Parallax.com). Additionally, spec for the SX is to tie /MCLR to Vdd through 10k, not 4.7k or some other value

    - RTCC can be tied to Vdd directly or through a 10k. I usually just tie it high. I don't think this would affect your particular application.

    Question: the en/dis jumpers on your RTC board are for enabling/disabling pull-ups on SDA and SCL? Is that right? So we should presume that SDA and SCL are pulled-up in your current setup?

    Now, in the code, it looks like you *must* receive a byte from the host (your PC?) in order to have the program continue after it TXes the time? Is that right? Are you indeed TXing to the SX from the PC? In other words, can you read the time out once? If so, if you TX a display command to the SX again, what happens?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-19 16:35
    I got from the sxfaq "Please note that two other input pins are available: The RTCC pin (add an external pull-up, or pull-down resistor), and the MCLR* pin which requires special attention. If this is left floating, the SX could randomly perform resets. Therefore, it is important to pull this pin up to Vdd using a resistor (4.7 to 10 kOhm would be fine)."

    also "A: When the RTCC input is not used, it is a good idea to tie it to some defined level instead of leaving it “floating”. A good idea might be to connect it to Vdd via a pull-up resistor of say, 4.7 kOhm.
    Imagine what would happen in an "ISR-less" application when you have set bit 5 in the OPTION register by some reason (i.e. RTCC roll-over interrupt enabled), with a floating RTCC input randomly incrementing the RTCC, and finally causing a jump to $000 on a roll over. As your program does not contain any spe-cific ISR code, it might restart, or perform some other crazy operations."

    so that is where I got the 4.7k. Though I completely skipped over the reset button area of the schematic when I was looking through it. I'll have to remove the MCLR resistor I put in. I think the RTCC pin should be tied to something.

    The jumpers on the 1307 board do enable/disable the 10k resistors built in to the 1307 board and are enabled.

    what is happening, is I do get the serial out asking what type of display I want after doing a program(ctrl+p). I choose, and it send the wanted formatted time out. It keeps repeating the time out until it randomly stops. I haven't been able to get it to start without me doing a program with the resonator already plugged in. Looking through the code, it doesn't care if the PC transmits again. I think I've hit keys while it was displaying the time, but not sure. Will have to test.
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-19 18:49
    I don't think it is a code thing. I just made up a quick serial test, and it too stops after a little bit. Something hardware. But what and why?

    Edit:
    I forgot to say that i removed my resistor from the MCLR to VDD, no help. The program indeed does ignore input from the PC once the display has been chosen. Typing on the PC at that point doesn't cause the SX to stop.

    Also I edited my serialtest program so unused pins are input pull up. No help.

    Post Edited (Capdiamont) : 10/19/2008 7:51:51 PM GMT
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-20 05:40
    Ok, made a led flash program, which works with internal clock. External clock stops after a little bit. See Dual color LED flash program for code.

    How long should it take to self start an external clock sx?
  • ZootZoot Posts: 2,227
    edited 2008-10-20 20:35
    Should be instantaneous. Not sure what LED program you mention.

    Do you have a pullup (4.7k or so) on your serial pin (open true)? Not sure it would matter with your PC serial board.

    Tying RTCC to Vdd is fine.


    Have you tried a simple experiment just to see if the SX(es) are transmitting/receiving properly without hiccups? That way you could at least narrow down if it's the SX and it's related code/circuitry or something with your PC rx/tx board and the PC. I would set up one SX as a TX and one as an RX -- send a serial byte from one to the other (TTL serial, no driver needed). Have the RXing SX do something like:

    IF rxByte = %01010101 THEN
    Led = 1
    ELSE
    Led = 0
    ENDIF

    And have the TXing SX send that same byte every few seconds, then send 0 every few seconds. Basically have the TXing SX turn the led on and off on the RXing SX. If that works, then you can be confident that your RX/TX and SX setup is OK, and the question will be getting it to work properly to your PC through the driver (or vice versa smile.gif)...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-21 02:05
    http://forums.parallax.com/showthread.php?p=758922 for LED program.

    It has to be a hardware issue, if it stops flashing the LED in that program after a short bit. I have the ds1307 and the serial rs serial mini modules disconnected electrically from the proto board, and yet it will still stop after a short bit with the external clock.
  • CapdiamontCapdiamont Posts: 218
    edited 2008-10-24 05:03
    Ok, I've changed to a 4mhz resonator, added a 1meg ohm resistor between x1 and x0. Thanks to

    http://forums.parallax.com/showthread.php?p=748823

    for the idea. a 10k in place of the 1meg resistor didn't seem to work with my mini modules connected, however with the LED flash program alone, it works.

    So with the current setup, OCSHS1, in device 4_000_000 for freq, I can get it to run for a good while after programming, till I give up. Though, one glitch is the select display screen doesn't go away when I press a key on the PC. I have to remove the RX/TX leads from the mini module, to get past it.

    I still can't get it to self start.
Sign In or Register to comment.