Page 1 of 3
RTC Maxim DS1511Y IRQ woes
Posted: Tue Jun 20, 2017 10:56 pm
by jgroth
I've been trying to get IRQ working with this RTC for a couple of weeks but with no luck. What happens is that when I power on my SBC the RTC drives IRQ low despite the fact I've disabled IRQ in the init routine of the chip.
I've connected IRQ to the MPU (WDC65C02 1MHz) and it is pulled up (measured resistance between pin 5 on RTC and VCC and it is 3.3 kOhm). KS and Vbaux are grounded and PWR and RST are pulled up and not connected to anything else.
My init routine looks like this:
Code: Select all
21 >8000 0f rtcreg .byte wr_crb ;control B
22 >8001 08 .byte wr_seca ;alarm sec
23 >8002 09 .byte wr_mina ;alarm min
24 >8003 0a .byte wr_hrsa ;alarm hour
25 >8004 0b .byte wr_dowa ;alarm date/day
26 >8005 0c .byte wr_wdms ;watchdog msecs * 10
27 >8006 0d .byte wr_wds ;watchdog secs
28 >8007 0f .byte wr_crb ;control B
29 =8 n_rtcreg =*-rtcreg
34 >8008 80 rtcparm .byte wr_irqoff ;updates on & WDT IRQs off
35 >8009 00 .byte wr_secap ;no alarm secs IRQ
36 >800a 00 .byte wr_minap ;no alarm min IRQ
37 >800b 00 .byte wr_hrsap ;no alarm hour IRQ
38 >800c 00 .byte wr_dowap ;no alarm date/day IRQ
39 >800d 01 .byte wr_wdmsp ;10 ms underflows LSB
40 >800e 00 .byte wr_wdsp ;10 ms underflows MSB
41 >800f 00 .byte wr_crbpa ;updates & WDT IRQs off
56 .8010 INITRTC
57 .8010 a0 07 LDY #N_RTCREG-1
58 .8012 L10
59 .8012 b9 08 80 LDA RTCPARM,Y
60 .8015 be 00 80 LDX RTCREG,Y
61 .8018 9d a0 7f STA IO_RTC,X
62 .801b 88 DEY
63 .801c 10 f4 BPL L10
64 .801e 60 RTS
When this code is run, interrupts are turned off. If I understand the datasheet right all IRQs should be turned off but updates of internal to external registers should be enabled.
Yeah, some of you might recognise the constants

. I got a bit desperate when nothing worked and starting to copy code that is supposed to work. Still doesn't work unfortunately. I tried the same setup with another DS1511Y and got the same results. If it matters I bought both from digi-key.
If I disconnect the IRQ line, I can set the time/date and read it as well. I just can't get interrupts to work.
Has anyone here experienced anything like this with the DS1511Y?
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 7:52 am
by Dr Jefyll
Is the wiring for the RTC newly added? New wiring can have errors, either in the design documents or in the actual device as built. Have you checked that all the address and data lines are connected properly?
Although it's seemingly possible to write to the registers and read them back, that sort of test isn't ideal -- in certain fluky cases it might be possible to get a false assurance that all's well. For example you may be accessing a register other than the one you think you're accessing -- and this may not be apparent. Likewise you might be accessing the correct register but with some of the data bits swapped (and when you read them back a complementary swap occurs -- again preventing the error from being apparent).
If the wiring checks out then as a test you could try recoding the initialization in a way that doesn't use indexed addressing to write to the I/O device. IOW try not using
STA IO_RTC,X. NMOS 6502's have known difficulty with this sort of thing (as does the '816 if the VDA pin is left unused). The 65C02 is billed as being fixed, but dclxvi
discovered that in reality the fix falls short of its description. It's possible you've stumbled onto another anomaly, although I highly doubt it. Still, it's something to try when all other ideas are exhausted.
Good luck, and let us know how you make out!
-- Jeff
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 8:09 am
by BigDumbDinosaur
I've been trying to get IRQ working with this RTC...KS and Vbaux are grounded and PWR and RST are pulled up and not connected to anything else.
The DS1511Y data sheet says this about KS:
- Active-Low Kickstart Input. This pin is used to wake up a system from an external event, such as a key closure. The KS pin is normally connected using a pullup resistor to VBAUX. If the KS function is not used, connect to ground.
Despite what the data sheet says,
KS should be pulled up to Vcc through a suitable resistor. That may be where your problem is located.
BTW, to continue with Jeff's line of thought, is the RTC really mapped in at $7FA0? That seems like an odd address for I/O hardware.
If you can, please post your schematic.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 11:31 am
by jgroth
I've been trying to get IRQ working with this RTC...KS and Vbaux are grounded and PWR and RST are pulled up and not connected to anything else.
The DS1511Y data sheet says this about KS:
- Active-Low Kickstart Input. This pin is used to wake up a system from an external event, such as a key closure. The KS pin is normally connected using a pullup resistor to VBAUX. If the KS function is not used, connect to ground.
Despite what the data sheet says,
KS should be pulled up to Vcc through a suitable resistor. That may be where your problem is located.
Huh, will try that tonight.
BTW, to continue with Jeff's line of thought, is the RTC really mapped in at $7FA0? That seems like an odd address for I/O hardware.
Yes, I'm using Daryl Rictor's SBC 2.5 address decoding logic which places IO at $7FXX. So the memory map looks like:
- $7F00-$7FFF I/O in 32 byte blocks
I've also triple checked that all wires goes to the right place on the MPU.
If you can, please post your schematic.
Attached. I see now that the direction of /PWR is wrong. It should be an outgoing signal (not that it matters, it's pulled high).
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 5:26 pm
by BigDumbDinosaur
If you can, please post your schematic.
Attached. I see now that the direction of /PWR is wrong. It should be an outgoing signal (not that it matters, it's pulled high).
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections.

There must be some blue or something in there. It appears to me that information is missing.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 6:15 pm
by jgroth
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections.

There must be some blue or something in there. It appears to me that information is missing.
Yes, the data bus is blue. So here's the schematics in good old black and white (OT I remember the joy of my parents buying a colour TV in 1976).
The RTC and two VIAs.
Daryl Rictor's address decoding logic.
MPU, ROM and RAM
Sheet layout
Mind you I have changed the schematics so the /KS pin is pulled high. I haven't tested if that fixes the problem though.
I hope I haven't missed anything and thank you so much for taking time to look at this.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Wed Jun 21, 2017 9:41 pm
by BigDumbDinosaur
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections.

There must be some blue or something in there. It appears to me that information is missing.
Yes, the data bus is blue. So here's the schematics in good old black and white (OT I remember the joy of my parents buying a colour TV in 1976).

Two things I noted:
- I see a 74LS138 decoder in the system. That part should be a 74AC138 or 74HC138 (which is not very fast). You should avoid mixing logic types. In particular, the 'LS138 outputs will not pull all the way up to Vcc when the corresponding devices are not being selected, which could cause some really weird problems to randomly occur.
- It appears that you have the MPU's SO input marked as a no-connect. SO must be pulled up to Vcc, even if not used for anything. As a general rule, CMOS inputs should never be floated, as noise can cause device instability.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 7:18 am
by BigEd
... You should avoid mixing logic types.
Hmm, I think this a case of being far too prescriptive. I know you aim to be helpful BDD, and it takes more effort to say exactly what you mean, but it's often worth the effort. Otherwise you give bad advice, or contradict yourself, which may affect the way your advice is taken.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 8:20 am
by GARTHWILSON
I've found that many people do the 74LS markings on the schematic because it's already in the CAD library, but they don't plan on actually using LS when it comes time to stuff the board.
I definitely discourage using LS myself. If at least HC (or HCT in some cases) is available, there's no reason anymore to use LS.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 8:27 am
by BigEd
Ideally we'd have a good post - perhaps a sticky post - discussing logic families. Then we wouldn't need to summarise our wisdom in a single sentence! (There might already be such a post - I haven't looked.)
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 8:35 am
by GARTHWILSON
Ideally we'd have a good post - perhaps a sticky post - discussing logic families. Then we wouldn't need to summarise our wisdom in a single sentence! (There might already be such a post - I haven't looked.)
See the 74xx logic families page on the 6502 primer, at
http://wilsonminesco.com/6502primer/LogicFamilies.html in the 6502 primer. There are lots of links to relevant ap. notes at the bottom too.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 8:39 am
by BigEd
I was thinking of an overview. We have linked before to this page:
http://www.interfacebus.com/voltage_threshold.html
Edit: and you previously posted this:
viewtopic.php?p=6112#p6112
Re: RTC Maxim DS1511Y IRQ woes
Posted: Thu Jun 22, 2017 5:03 pm
by BigDumbDinosaur
... You should avoid mixing logic types.
Hmm, I think this a case of being far too prescriptive. I know you aim to be helpful BDD, and it takes more effort to say exactly what you mean, but it's often worth the effort. Otherwise you give bad advice, or contradict yourself, which may affect the way your advice is taken.
Prescriptive??? Bad advice??? How is stating a basic engineering tenet of digital electronics prescriptive and/or bad advice?
I said EXACTLY what I meant: one should
AVOID mixing logic types. I didn't say
DON'T mix logic types. Obviously, there are situations where mixed logic is acceptable, such as a 74LS' device driving the input of a 74ACT device. This is not one of those situations. In this particular case, the use of the output of a 74LS' device (74LS138) to drive the input of a CMOS device, specifically the W65C22S (whose inputs must be driven to at least
Vcc × 0.8 to qualify as a valid high), can create a potential "it might work today but not tomorrow" condition.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Mon Jun 26, 2017 9:02 pm
by jgroth
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections.

There must be some blue or something in there. It appears to me that information is missing.
Yes, the data bus is blue. So here's the schematics in good old black and white (OT I remember the joy of my parents buying a colour TV in 1976).

Two things I noted:
- I see a 74LS138 decoder in the system. That part should be a 74AC138 or 74HC138 (which is not very fast). You should avoid mixing logic types. In particular, the 'LS138 outputs will not pull all the way up to Vcc when the corresponding devices are not being selected, which could cause some really weird problems to randomly occur.
Well, all 74xx ICs are HCT. There are very few HC/HCT 74s in the KiCad libraries I've got.
[*]It appears that you have the MPU's SO input marked as a no-connect. SO must be pulled up to Vcc, even if not used for anything. As a general rule, CMOS inputs should never be floated, as noise can cause device instability.
Oops, missed that one (and it is also missed on SBC v2.5). OK pulled high now and the /IRQ pin is still low.
Re: RTC Maxim DS1511Y IRQ woes
Posted: Tue Jun 27, 2017 12:51 am
by Dr Jefyll
the /IRQ pin is still low.
Are you able to single-step? I'm assuming that immediately after reset the /IRQ pin is high (although that'd be worth verifying). Then if you single-step through the initialization code you'll be able to see which instruction coincides with the /IRQ pin going low. That ought to tell you what's going on -- or at least lead to some new, better questions.
