Shop OBEX P1 Docs P2 Docs Learn Events
P2 RTC Add-on Board — Parallax Forums

P2 RTC Add-on Board

I have hooked up the P2 RTC Add-on Board on P40 thru P47 and it will not work. The RTCBASE = 40 is set so why will it work on lower pins (P0 thru P39) but not above (P40 thru 47).
By not work I mean it locks up the Prop2 when it gets to spin2 setup_64013RTC() method.

Comments

  • evanhevanh Posts: 16,032
    edited 2024-08-26 10:53

    Source code? And what add-on board? Some links maybe helpful.

  • celtic3celtic3 Posts: 16
    edited 2024-08-26 12:39

    evanh Thats the add on board "P2 RTC add - on Board" using the provided code on Parallax site.
    https://www.parallax.com/product/p2-rtc-add-on-board/
    '' ================================================================================================= '' '' File....... 64013_RTC_Driver.spin2 '' Purpose.... Low level driver object for Parallax RTC Add-on #64013 '' '' Author..... Michael Mulholland '' -- based on code shared by Jon "JonnyMac" McPhalen '' '' E-mail..... support@parallax.com '' Started.... '' Updated.... 30 NOV 2020 '' '' =================================================================================================
    I think it has to do with those pins not the code, acts like it dosen't see the pins.

  • evanhevanh Posts: 16,032

    Thank you.
    I've had a look now and don't see any setup_64013RTC() method.

  • celtic3celtic3 Posts: 16
    edited 2024-08-26 14:05

    sorry that is the setup method in main code , but as i said it is just the RTCbase = 40 that creates the problem. Any other pin lower than that is fine.

    pub setup_64013RTC() | x
      'rtc.init( DS_clk, DS_data, DS_CE )                  ' clock, data, chip-enable
      if !rtc.start(RTCBASE, true)                                  ' start rtc, or else quit. 2nd parameter forces calibration if true
      lcd.drawString(320,1, "Failed to start RTC")
      x := 0
      repeat until rtc.oscillator_ready()                           ' ensure rtc clock running before proceeding
        waitms(500)
        if (x++ > 8)                                                ' timeout, rtc module didn't start
          lcd.drawString(320,1, "Oscillator not detected!")
      '' Optional - Check battery
      if rtc.battery_low()
        'theEnd()
      '' Optional - Reset the RTC settings to default
      'rtc.sw_reset()
      '' Optional - Set battery mode
      '' -- Tip! Might be good to enable battery in-case it was previously disabled for shipping or storage
      rtc.set_battery_mode(rtc.BATT_ENABLE)                        ' BATT_ENABLE, BATT_DISABLE
      '' Calibration - call anytime if ambient temperature changes significantly
      '' - calling here for example only- change paramater to true to save the calibration result.
      rtc.calibrate(false)                                        ' true to store calibration, false to read (but not store).
      '' Pre-load some variables
      sc, mn, hr := rtc.get_time()                                  ' sc = seconds, mn = minutes, hr = hours
      dt, mo, yr := rtc.get_calendar()                              ' dt = day (0..31), mo = month (1..12), yr = year (2001..2099)
      wd         := rtc.get_weekday()                               ' wd = weekday digit 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat
      'lastsc     := lastwd := -1                                    ' helper variables for previous-seconds and previous-weekday values
    
  • Has some indenting has gone awry in that code snippet? Maybe your using a different code editor to the one Parallax published the code under?

    For example, after : if !rtc.start, the next line "lcd.drawString..." seems like it should be indented ?

  • .. could you attach the code archive exactly as you are using it? That would make it quicker to help, if we can see the details.

  • celtic3celtic3 Posts: 16
    edited 2024-08-26 18:05

    Do pins 40 thru 47 have limitations on how they are accessed, or should they work with pinr pinw pint ect, because I have nothing assigned to them that would interfere.
    Further
    I loaded and ran the follwing code by itself..................
    pins 40 thru 47 with no result
    pins 0 thru 39 with good result (sound)

    repeat 300
        pint()
        repeat 1000
        pint()
        repeat 100
    

    so again...
    Do pins 40 thru 47 have limitations on how they are accessed, or should they work with pinr pinw pint ect,

  • JonnyMacJonnyMac Posts: 9,159

    Q: Are you using the P2 with 32M RAM on it? If that's the case, you need to use a group in the lower 32 IO pins. A friend of mine just ran into this when he accidently purchased Edge modules with RAM.

  • celtic3celtic3 Posts: 16
    edited 2024-08-26 18:14

    Thank you Jon
    Yes i am using the 32M
    Does that interfere with the upper pins because they use that for communication addressing?

  • JonnyMacJonnyMac Posts: 9,159
    edited 2024-08-26 18:32

    Yes, it does. My friend ran into this when he accidentally plugged the RAM-enabled Edge into one of his products. I think the lower 40 pins are available for general-purpose use. Move your RTC to the P32-P39 group and see if that works.

    You can download the schematic from:
    -- https://www.parallax.com/package/p2-edge-module-with-32mb-ram-schematic/

    It shows on page 2 that pins P40..P55 are not available on the Edge that has 32M of RAM added.

  • Wuerfel_21Wuerfel_21 Posts: 5,107
    edited 2024-08-26 18:25

    The P40 through P57 just don't exist as I/O on the EC-32MB. They're connected to the RAM chips and nothing else. 16 data bus pins at 40..55 could in theory be used while the RAM is not selected, but if you had the EDGE in something like the big breadboard breakout, the long floating traces would destroy the signal integrity.

Sign In or Register to comment.