Shop OBEX P1 Docs P2 Docs Learn Events
Trying to run the RTC for first time on Spinneret — Parallax Forums

Trying to run the RTC for first time on Spinneret

T ChapT Chap Posts: 4,223
edited 2013-12-28 08:30 in Propeller 1
I get a successful status LED on running the S35390A RTC Setup, it fails if I change the pin assignments to the RTC on the Spinneret so I am assuming the chip is connected during the setup. I get -1 returns on trying to test the chip with the following code. Any suggestions on what to do here?
CON

  _clkmode = xtal1 + pll16x ' The clkfreq is 80MHz.
  _xinfreq = 5_000_000 ' Demo board compatible.

  _rtcclkpin = 28 ' -1 if unused.
  _rtcdatpin = 29 ' -1 if unused.
  _rtcbuslck = -1 ' -1 if unused.

  _statuspin = 23 ' Status LED pin number.
OBJ
   pst: "Parallax Serial Terminal"
   rtc: "S35390A_RTCEngine"

VAR

PUB Init
    dira[_statuspin]~~
    repeat 5
      outa[_statuspin]~~
      waitcnt(5_000_000 + cnt)
      outa[_statuspin]~
      waitcnt(5_000_000 + cnt)
    pst.Start(115200)
    pst.Clear
    pst.str(string("Start PST"))
    pst.dec(rtc.RTCEngineStart(_rtcdatpin, _rtcclkpin, _rtcbuslck))   '  -1
    waitcnt(1000000 + cnt)
    repeat
      pst.dec(rtc.readTime)    '  -1
      waitcnt(1000000 + cnt)
      pst.LineFeed
      waitcnt(80000000 + cnt)

Comments

  • T ChapT Chap Posts: 4,223
    edited 2013-12-26 19:46
        repeat
          pst.dec(rtc.readTime)    '  -1
          waitcnt(1000000 + cnt)
          pst.LineFeed
    
          pst.dec(rtc.clockmonth)
          waitcnt(1000000 + cnt)
          pst.LineFeed
    
          pst.dec(rtc.clockDay)
          waitcnt(1000000 + cnt)
          pst.LineFeed
    
          pst.dec(rtc.clockHour)
          waitcnt(1000000 + cnt)
          pst.LineFeed
          waitcnt(80000000 + cnt)
    

    Actually, after adding the extra code to read the specific values I get good results. Sorry

    -1
    12
    4
    10

    Next task, to learn how to use the SD card on the Spinneret. Looking through the various SD related objects. If there is a recommended starting point for a demo that would be welcome.
  • Mike GMike G Posts: 2,702
    edited 2013-12-27 02:27
    For the SD card, I use Kwabena's S35390A SD-MMC File Allocation Table Engine.

    The Spinneret forum has a lot of information. There's also a Spinneret code repository containing sample code and libraries.
  • T ChapT Chap Posts: 4,223
    edited 2013-12-27 06:23
    Thanks Mike. Here is the first goal. I have been looking at the driver you mentioned.

    1. Create a file ErrorLog. On an error, open the file, append Mo/Day/Hour/Min/Errorbytecode

    2. At some frequency, upload all errors with time stamp to a remote server and/or allow access to the errorlog file remotely from the internet accessing the Spinneret and view as html page.

    3. Transfer Propeller binary to SD card remotely over internet, verify the written file either with checksum or complete comparison with the original at the source computer. Transfer binary on SD to eeprom.

    4. Email user(s) of errors

    5, Log access times with fingerprint or code entry to file AccessLog. Email the log at some frequency, and/or allow access to view log as html page remotely.
  • Mike GMike G Posts: 2,702
    edited 2013-12-28 08:30
    1. Create a file ErrorLog. On an error, open the file, append Mo/Day/Hour/Min/Errorbytecode
    This is pretty easy. It's just a matter of reading the SD and RTC library source comments.
    2. At some frequency, upload all errors with time stamp to a remote server and/or allow access to the errorlog file remotely from the internet accessing the Spinneret and view as html page.
    Pushing stored data is always a bit trickier than a plain old Request/Response. I like to send errors or informational message in real time to another server via HTTP POST. It's far less overhead, easier to manage, and extensible.
    3. Transfer Propeller binary to SD card remotely over internet, verify the written file either with checksum or complete comparison with the original at the source computer. Transfer binary on SD to eeprom.
    I did this a while back. It's not difficult but there are few moving parts. If I did this over again I would use a staging server to hold the binary image. Then send a message to the Spinneret to GET the image from the staging server.
    4. Email user(s) of errors
    There are SMTP demos in the repo. I'm not a fan of emailed error alerts. My inbox is full of 'em at work which I ignore until a real person sends me an email.
    5, Log access times with fingerprint or code entry to file AccessLog. Email the log at some frequency, and/or allow access to view log as html page remotely.
    I'm sure what you mean by a fingerprint or code entry. I assume you want to know who accessed the Spinneret? If so, that would mean sending credentials on each request. You can find basic authentication in the code repo under the W5200 directory. You can also log the client IP address. Like item 2, I would send a POST request to some other server to log access events.
Sign In or Register to comment.