The attached file contains the source code of two modules RTC.Mod and SPI1.Mod which provide support in RISC5 Project Oberon for the Maxim DS3234 Real-Time Clock device. The DS3234 is a battery-backed chip that provides continuous time (hours, minutes and seconds) and date (year, month and day) information accurate to +/- 2 minutes per year via an SPI interface.
As well as providing the ability to automatically timestamp Project Oberon files it can be used with the Astrobe HCFiler filesystem functions to implement accurate datalogging applications.
The RTC device is available as a convenient Deadon RTC breakout board from SparkFun:
Links to the schematics, DS3234 datasheet etc. are all available from that webpage.
(There are cheaper knockoffs of the breakout board available on the Internet. However, we tried a couple and wasted a whole lot of time before realising that the battery backup didn't work on both so be warned ...)
What you need to do to make it all happen:
1. Unzip the attached source code files into the folder containing System.Mod and Oberon.Mod.
2. Connect the breakout board to the corresponding pins of the SPI1 port of a Project Oberon system. e.g. the Pmod-D port of the Digilent Arty-7 and Arty-S7 FPGA Development boards. Note: for these systems the GND and VCC connections are reversed.
3. The RTC device uses SPI Mode 3. This requires a change to the RISC5 Verilog file SPI.v :
Change the 0 in the following line to a 1:
assign SCLK = (~rst | rdy) ? 0 : fast ...
i.e.
assign SCLK = (~rst | rdy) ? 1 : fast ...
(a big thanks to Paul Reed for suggesting this change!)
4. Regenerate the FPGA Bitstream file using the Xilinx tools and reconfigure your target FPGA board.
5. Add RTC to the IMPORT list of Files.Mod, Oberon.Mod and System.Mod and replace calls to Kernel.Clock and Kernel.SetClock in those modules with the corresponding calls RTC.Clock and RTC.SetClock.
6. Rebuild your Project Oberon system.
7. Restart Project Oberon and enter the command System.Date with the current date and time in dd/mm/yy hh:mm:ss format to set the date. Enter the command System.Date without any parameters to display the current date and time:
However, if you prefer to wait, the next release of Embedded Project Oberon will include these modifications 'out of the box'.
RISC5 Real-time Clock support
-
- Site Admin
- Posts: 525
- Joined: Fri Dec 31, 2010 12:30 pm
- Contact:
RISC5 Real-time Clock support
- Attachments
-
- RTC.zip
- RTC.Mod, SPI1.Mod
- (2.43 KiB) Downloaded 3054 times
Re: RISC5 Real-time Clock support
Is it possible to connect the DS3234 to the Pepino LX9?
-
- Site Admin
- Posts: 525
- Joined: Fri Dec 31, 2010 12:30 pm
- Contact:
Re: RISC5 Real-time Clock support
Yes - if you are not using the nRF24L01+ RF module you can connect the DS3234 to the Pepino LX9 using the J7 connector.
The Astrobe Pepino disk image includes all of the necessary RTC software and will automatically detect the DS3234 on SPI1 at boot time.
The Astrobe Pepino disk image includes all of the necessary RTC software and will automatically detect the DS3234 on SPI1 at boot time.