RTC

From SpecNext official Wiki
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).

Hardware Requirements

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

Software Support

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

You can also set the time with the .NXTP command if you have WIFI setup and configured.

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, as long as it has been set the date and time automatically appear in the NextZXOS 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 then they are likely parts of the HDMI connection or maybe you have something connected on J15.

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