Wednesday, 7 December 2016

Quantel Paintbox V-Series - Setting The RTC Date

I have recently been playing around getting a Quantel Paintbox (V-Series Harriet) running. During the process i had to replace the battery backed SRAM which also contained the Real Time Clock (RTC).

Within the Paintbox user interface there is an option to set the time but not the date, this is even true in the engineering console where you have more access to the operating system. The only way to set the date is to manually set the RTC clock by poking bytes into a memory location.

This is due to Quantel's time-limited software keys. If there was an easy way to set the date then it would be easy to circumvent their feature expiry time by simply adjusting the system date before the key expires.

The V-Series CPU3 (also CPU3, CPU42 & CPU43) board has two battery backed SRAMs, these are the ST MK48Z02 and the MK48T02. The 'Z' version is a regular SRAM, the 'T' version includes a RTC which is mapped into the last 8 bytes of the MK48T02's 2048 byte address space.

In the CPU3 implementation 'RF' (the component designation on the PCB silkscreen) is the MK48T02 and 'RD' is the MK48Z02. Both devices are memory mapped into the 68000 address space starting at $040000 to $040FFF. The MK48Z02 is mapped to EVEN bytes and the MK48T02 is mapped to ODD bytes to give a total capacity 4,087 bytes (accounting for the 8 RTC control registers).

According to the datasheet for the MK48T02 device the RTC register map is as follows:

Add  D7 D6 D5 D4 D3 D2 D1 D0
7FF:  -  -  -  -  -  -  -  - : Year 00-99
7FE:  0  0  0  -  -  -  -  - : Month 01-12
7FD:  0  0  -  -  -  -  -  - : Date 01-31
7FC:  0 FT  0  0  0  -  -  - : Day 01-07
7FB: KS  0  -  -  -  -  -  - : Hours 00-23
7FA:  0  -  -  -  -  -  -  - : Minutes 00-59
7F9: ST  -  -  -  -  -  -  - : Seconds 00-59
7F8:  W  R  S  -  -  -  -  - : Control

ST=Stop Bit
R=Read Bit
FT=Frequency Test
W=Write Bit
S=Sign Bit

KS=Kick Start Bit


To translate this to the Paintbox memory map we must multiply the address by 2 and add $40001. So the map becomes:

Add    D7 D6 D5 D4 D3 D2 D1 D0
40FFF:  -  -  -  -  -  -  -  - : Year 00-99
40FFD:  0  0  0  -  -  -  -  - : Month 01-12
40FFB:  0  0  -  -  -  -  -  - : Date 01-31
40FF9:  0 FT  0  0  0  -  -  - : Day 01-07
40FF7: KS  0  -  -  -  -  -  - : Hours 00-23
40FF5:  0  -  -  -  -  -  -  - : Minutes 00-59
40FF3: ST  -  -  -  -  -  -  - : Seconds 00-59
40FF1:  W  R  S  -  -  -  -  - : Control


You can poke bytes into these addresses using the Quantel AFS Monitor on the serial port prior to booting the Paintbox software or you can use the 'MEMORY' command from within the Paintbox console.

Using the AFS Monitor to set the date to Wednesday 7 December 2016, remembering the values are BCD and the year is defined as years since 1980.

At the command prompt:

Allow write access to registers & stop clock:
40FF1;80

Set the day of week:
40FF9;03

Set the date:
40FFB;07

Set the month:
40FFD;0C

Set the year:
40FFF;36

Disable write access to registers & start clock:
40FF1;00