Amiga.org

Amiga computer related discussion => Amiga Hardware Issues and discussion => Topic started by: motorollin on March 07, 2007, 07:31:37 PM

Title: Interfacing serial RTC chip with serial port
Post by: motorollin on March 07, 2007, 07:31:37 PM
I've found a Serial Interface Real Time Clock Module (http://www.epsontoyocom.co.jp/english/product/rtc_set.html). I'm wondering if there's any way to interface it with the serial port on an Amiga. I might then be able to write a simple Blitz Basic app to read the time and date from the serial port and set the Amiga's clock.

Would anybody have any idea if this is possible?

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: Tahoe on March 07, 2007, 08:06:56 PM
Why would you want to? Is your onboard RTC dead? Or does your miggy not have one?
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 07, 2007, 08:09:53 PM
The battery on my A4000 was removed before I bought it, and I refuse to put a soldering iron anywhere near it to solder a lithium battery in.

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: Tahoe on March 07, 2007, 08:13:56 PM
Right; so your on-board RTC is probably running just fine; you just need something to hold the time for you?

Is the "SAVE" button greyed out in Prefs/Time? If not your RTC is working fine and you only need a battery.

You could ofcourse also sync time with a internet based time source; your miggy would keep time until switched off..
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 07, 2007, 08:18:19 PM
Quote
Tahoe wrote:
Right; so your on-board RTC is probably running just fine; you just need something to hold the time for you?

Correct.

Quote
Tahoe wrote:
Is the "SAVE" button greyed out in Prefs/Time? If not your RTC is working fine and you only need a battery.

Yes, but as I said I don't want to solder a bettery to the motherboard.

Quote
Tahoe wrote:
You could ofcourse also sync time with a internet based time source; your miggy would keep time until switched off..

I have done this, but I don't always want to connect to the Internet because it causes problems with WHDLoad.

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: shoggoth on March 07, 2007, 09:11:17 PM
The serial interface on the clock modules you referenced use a synchronous serial interface. The serial port on the Amiga is asynchronous. You'd be better of using the parallel port and use bit-banging.

-- Peter
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 07, 2007, 09:13:27 PM
Quote
shoggoth wrote:
You'd be better of using the parallel port

With that chip, or a different one?

Quote
shoggoth wrote:
and use bit-banging.

I have no idea what that means :-)

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: InTheSand on March 07, 2007, 11:23:05 PM
Quote

Quote
shoggoth wrote:
and use bit-banging.

I have no idea what that means :-)


Heh! Bash on the hardware!

Read/write to the parallel port hardware directly, rather than going via an API...

 - Ali
Title: Re: Interfacing serial RTC chip with serial port
Post by: Dr_Righteous on March 09, 2007, 01:49:21 AM
It would be hundreds of times easier to solder a NiMH barrel battery (not the silly lithium coin batteries, you're just asking for trouble) in place on your motherboard than messing with an external RTC. I've done this on my A4000 and had no problems at all, and it's been in place for years.
Title: Re: Interfacing serial RTC chip with serial port
Post by: adolescent on March 09, 2007, 03:21:58 AM
RTC?  Why not just go with serial to GPS or atomic clock?
Title: Re: Interfacing serial RTC chip with serial port
Post by: alexh on March 09, 2007, 11:11:52 AM
Why not go for an NTP client application which updates your clock over the net every time you power on?

http://aminet.net/package/comm/tcp/facts

No soldering and I am sure you've already got a network.
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 09, 2007, 11:29:20 AM
@InTheSand
OIC, that's what I was planning to do with Blitz.

@Others who have suggested NNTP or soldering battery...
I've already explained why I don't want to do those.

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: _yak_ on March 09, 2007, 04:14:39 PM
@motorollin

The "serial" in the name of this chip doesn't refer to the RS-232 serial port. It uses a data/clock bus. Therefore it would be simplier to connect data in (DI), data out (DO) and clock (CLK) lines to the parallel port and access the parallel port registers directly (because parallel.device lets you only read/write data as bytes through the Dx lines, it doesn't give you separate control over the parallel port signals). This is called hardware banging.
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 09, 2007, 04:21:53 PM
Are DI, DO and CLK the only lines which need to connect to the parallel port? And is it as simple as powering the chip and connecting those lines to the port?

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: Stedy on March 09, 2007, 08:50:54 PM
Hi,

Yes, connecting DI, DO, CLK and ground to the parallel would be all you need to do. Power the chip from a 5V power supply, using perhaps a connection from your Amiga's power supply or a micropower regulator and a battery pack to retain the time when the power is off!

Another option but more involved would be to use a micrcontroller to interface to the chip and send the time to your Amiga via the serial port. This would have a lower CPU overhead.
Title: Re: Interfacing serial RTC chip with serial port
Post by: motorollin on March 10, 2007, 08:25:32 AM
Great, thanks for the info!

--
moto
Title: Re: Interfacing serial RTC chip with serial port
Post by: alexh on March 10, 2007, 09:38:04 AM
Quote
I don't always want to connect to the Internet because it causes problems with WHDLoad

The X-Surf is not a card which creates the spurious interrupts that are supposed to interfere with WHDload. Put it this way I've used my A4000 with X-Surf card constantly connected to my network using Miami for over 8 years with no issues.
Title: Re: Interfacing serial RTC chip with serial port
Post by: keropi on March 10, 2007, 09:40:20 AM
also the ariadne 1 network card does not mess with whdload... numerous times I had genesis online and played whd games....
Title: Re: Interfacing serial RTC chip with serial port
Post by: patrik on March 10, 2007, 10:46:39 AM
It works fine as long as you dont receive any traffic (no interrupts are generated). Try pinging the amiga whilst playing.


/Patrik
Title: Re: Interfacing serial RTC chip with serial port
Post by: Doobrey on March 10, 2007, 10:11:55 PM
Quote

motorollin wrote:
@Others who have suggested NNTP or soldering battery...
I've already explained why I don't want to do those.


What about using a pair of probe clips (http://rswww.com/cgi-bin/bv/rswww/searchBrowseAction.do?D=probe%20clip&Nr=AND%28avl%3auk%2csearchDiscon_uk%3aN%29&Ntk=I18NAll&Nty=1&Ntt=probe%20clip&Dx=mode%20matchpartial&Ntx=mode%20matchpartial&N=0&name=SiteStandard&forwardingPage=line&R=0424175&callingPage=/jsp/search/search.jsp&BV_EngineID=ccdfaddkgidehddcefeceeldgondhgi.0&cacheID=uknetscape) to hook onto the +5v and GND pins of the RTC chip to attach the new battery? (IIRC, it needs a resistor to limit the charging current between the battery and the +5v, the A4000 schematics should show the value needed )

If you're still thinking of using an i2c RTC chip, have a look at i2clib (aminet) (http://aminet.net/package/hard/hack/i2clib40), it has simple interfaces for parallel,serial and floppy ports, and the shared library takes care of all the bit banging.