6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Nov 13, 2024 2:34 am

All times are UTC




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Tue Jun 20, 2017 10:56 pm 
Offline

Joined: Thu Sep 15, 2016 1:52 pm
Posts: 60
Location: UK
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:
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?


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 7:52 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
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

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 8:09 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8483
Location: Midwestern USA
jgroth wrote:
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.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 11:31 am 
Offline

Joined: Thu Sep 15, 2016 1:52 pm
Posts: 60
Location: UK
BigDumbDinosaur wrote:
jgroth wrote:
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.

Quote:
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:
    $0000-$7EFF RAM
    $7F00-$7FFF I/O in 32 byte blocks
    $8000-$FFFF ROM
I've also triple checked that all wires goes to the right place on the MPU.

Quote:
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).


Attachments:
rtc_schema.png
rtc_schema.png [ 19.45 KiB | Viewed 4387 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 5:26 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8483
Location: Midwestern USA
jgroth wrote:
BigDumbDinosaur wrote:
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. :D There must be some blue or something in there. It appears to me that information is missing.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 6:15 pm 
Offline

Joined: Thu Sep 15, 2016 1:52 pm
Posts: 60
Location: UK
BigDumbDinosaur wrote:
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections. :D 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.
Attachment:
vias_and_rtc.png
vias_and_rtc.png [ 35.42 KiB | Viewed 4355 times ]

Daryl Rictor's address decoding logic.
Attachment:
address_decoding_and_support.png
address_decoding_and_support.png [ 25.82 KiB | Viewed 4355 times ]

MPU, ROM and RAM
Attachment:
cpu_rom_ram.png
cpu_rom_ram.png [ 21.94 KiB | Viewed 4355 times ]

Sheet layout
Attachment:
pluto.png
pluto.png [ 25.02 KiB | Viewed 4355 times ]


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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 21, 2017 9:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8483
Location: Midwestern USA
jgroth wrote:
BigDumbDinosaur wrote:
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections. :D 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:

  1. 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.

  2. 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.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 7:18 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
BigDumbDinosaur wrote:
... 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.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 8:20 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8540
Location: Southern California
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.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 8:27 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
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.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 8:35 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8540
Location: Southern California
BigEd wrote:
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.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 8:39 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 22, 2017 5:03 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8483
Location: Midwestern USA
BigEd wrote:
BigDumbDinosaur wrote:
... 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.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 26, 2017 9:02 pm 
Offline

Joined: Thu Sep 15, 2016 1:52 pm
Posts: 60
Location: UK
BigDumbDinosaur wrote:
jgroth wrote:
BigDumbDinosaur wrote:
In monochrome, please, and if possible, the entire schematic, not just the 1511's connections. :D 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:

  1. 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.

Quote:
  • 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.


    Top
     Profile  
    Reply with quote  
    PostPosted: Tue Jun 27, 2017 12:51 am 
    Offline
    User avatar

    Joined: Fri Dec 11, 2009 3:50 pm
    Posts: 3367
    Location: Ontario, Canada
    jgroth wrote:
    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. :)

    _________________
    In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
    https://laughtonelectronics.com/Arcana/ ... mmary.html


    Top
     Profile  
    Reply with quote  
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next

    All times are UTC


    Who is online

    Users browsing this forum: No registered users and 15 guests


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum

    Search for:
    Jump to: