RTC

From SpecNext official Wiki
Revision as of 13:27, 26 April 2019 by Daz (talk | contribs) (Added dot commands)
Jump to: navigation, search

A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don't already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).

Adding a RTC requires the following components:

  • 12pF Crystal
  • DS1307 IC
  • 8 pin DIL Socket
  • CR2032 Holder
  • CR2032 Battery

(6pF Crystals have been reported to work)

This is the mounting position on the PCB:

RTC Port Location.jpg RTC Port.png

The TBBlue SD Distribution contains dot commands "DATE" and "TIME" for working with the RTC:

.DATE "31/12/2017" Set the date to new years eve
.DATE Print the current date
.TIME "00:30:00:" Set the time to 30 minutes after midnight
.TIME Print the current time
.TIME -h Print help message

If you use these without a RTC soldered to the board they will just give an error that no signature is found or No ACK received. You can however use the option TIME -d to get the contents of the chip which will be junk if the RTC is not fitted but, but may help to diagnose any problems getting it working.

When the RTC is fitted, the date and time automatically appear in the NextOS menus. The ".ls" command will print a file listing with dates, and "cat exp" will show times as well.

You can get the contents of a dot command into a string using this NextBASIC:

DIM a$(100):OPEN #2,"v>a$":.TIME:CLOSE #2:PRINT a$

You can effectively "touch" a file in BASIC to update its timestamp with:

OPEN #4,"u>filename":CLOSE #4

The RTC is connected to the I2C bus. Also supplied is a DOT command called I2CSCAN - this will search the I2C bus for any devices found which can help in seeing what is connected. You should see at least one device at 0x68 if the RTC chip is connected. If you see others when you have nothing on J15 then make sure you have the latest TBU, any Capacitor mod etc - if so and you still have others detected then please contribute to the RTC posts on Facebook or the Forum.

Further information, including ESXDOS support, can be found on the TBBlue Distribution in the file \docs\extra-hw\rtc\RTCI2CTIMEDATEreadme.txt