6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 3:20 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Sat Mar 11, 2023 4:51 pm 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
I’m looking for some assistance with a problem which has got me really stumped.
I have been trying to battery protect a AS6C1008 128K RAM to effectively turn it into NV RAM. From my research, this should be very straightforward.

Initially I thought about just using a CR2032 battery, and saw someone on YouTube who had done this by using two diodes to stop unwanted flow between the 5v rail and the CR2032 cell
Trouble with this was when I just wired up a little test (with no ICs) , the voltage out was pushing 7v which exceeds the spec of the RAM chip – which doesn’t seem a very good idea.

So, I researched nonvolatile controller chips, and they looked just what I needed. I have a ‘lite’ xmodem based upload function, so I can populate a chunck of RAM with a bit of Dickens & Shakespeare for testing purposes.

I wired up a DS1210 NV controller to my RAM chip, and data does indeed persist – for a few minutes. After about 10mins, though, when I power up & check RAM, contents are ALL set to 0x00.

If I disconnect the battery, RAM contents are random on power up, just as one would expect.

I have tried various configurations of the DS1210, changing the tolerance pin from VCCO to G to change the trigger voltage. I have tied the /chip enable in (/CEI) low and not connected /chip enable out(/CEO), so I only use the battery function and no RAM write control. I have connected CEO to the AS6C1008 /CE, and also tried an inverted select signal to connect it to the CE2. I have used a different battery.
Whatever I do, I seem to get the same result.
So, I wondered if I have a duff DS1210 chip (bought from eBay from a UK seller).
So I ordered a Maxim DS1321 NV controller to test this hypothesis, wired it all up, and I have exactly the same behaviour.

The NV controller is obviously doing SOMETHING, as I’m getting ‘clean’ RAM contents (i.e. 0x00) on power up instead of random contents.

With my MM ground lead at the RAM ground pin, when the system is powered up, the RAM VCC is at 4.7V. When I turn the system off, the RAM VCC is at 3V, as expected from the battery & DS1321. The DS1321 /CEO is at 3V, the battery warning is at 3.8V and the battery anode is at 3.3V. All as expected I leave it for 15 min, and contents are all 0x00, voltages all seem OK still


I have built 8 bit breadboard computers in the past but I’m pretty much an electronics novice, so there could well be something stupidly obvious to those more educated in electronics than I! This system is all breadboarded. 5v is supplied from an old SONOS bridge mains adapter.

I’ve been struggling with this for about a fortnight, and I'm starting to get a bit frustrated, so any suggestions and/or pointers would be very welcome.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 11, 2023 8:28 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
See if this post helps:
viewtopic.php?p=32004#p32004
The method is pretty simple.

_________________
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: Sat Mar 11, 2023 9:17 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
Ds1210 plus Backup battery plus 128K RAM as nonvolatile RAM solution should all work just fine. I have a couple RAM-only designs based on that concept and they kept the memory content good for at least 2 years and numerous power cycles without data corruption. https://www.retrobrewcomputers.org/doku ... o:z80sbc64
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 11, 2023 10:05 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
8bitPogle, it caught my attention when, near the beginning of your post, you said, "when I just wired up a little test (with no ICs) , the voltage out was pushing 7v." I assume you were expecting 5 volts (or close).

Be aware that, although most power supplies will maintain their rated output voltage even when no load is present, there are some for which this isn't true. :!: They require a certain minimum load (ie, that a certain amount of current, listed in the specifications, be drawn). If you fail to draw at least this minimum amount they can lose regulation and output more than the expected output voltage. It sounds as if this may've happened to you. :|

Your best option, IMO, is to simply stop using that power supply! :shock: Otherwise, I suggest you find out what minimum load it requires and permanently attach a suitably sized resistor as a dummy load which will draw (and waste) that specified minimum amount. (Let us know if you need help determining the resistance and wattage of the resistor.)

I can't help wondering if this minimum load issue has affected some of the other observations mentioned later in your post!

-- 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: Sun Mar 12, 2023 8:15 am 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 460
Location: Canada
Just looking at the specs for AS6C1008 it says the data retention voltage is 1.5v. At 3V the device could be operating - the operating range is 2.7 to 5V. If CE is tied low won't the RAM be enabled?

_________________
http://www.finitron.ca


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 12, 2023 10:53 am 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
GARTHWILSON wrote:
See if this post helps:
viewtopic.php?p=32004#p32004
The method is pretty simple.



Thanks Garth.

This was one of the articles I came across when I was researching this, so I have seen it.
I'll have a go at this as well, as it's all part of the learning process, but I would like to find out what's happening with my DS1210/DS131 as using these should be very straightforward.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 12, 2023 10:59 am 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
plasmo wrote:
Ds1210 plus Backup battery plus 128K RAM as nonvolatile RAM solution should all work just fine. I have a couple RAM-only designs based on that concept and they kept the memory content good for at least 2 years and numerous power cycles without data corruption. https://www.retrobrewcomputers.org/doku ... o:z80sbc64
Bill


Thanks Bill

Completely agree that, based on my reading & the datasheet, using either of the DS1210/DS1321 should be very straightforward - even for someone of my limited experience. That why I'm wondering if I have some obscure issue, OR I've done something so stupid that no-one has bothered to mention it in any of the documentation I have found.
I'll have a read through those links and see what I can glean.

By the way, the system is working just fine - I can run a little test that just output ASCII chars to a 20x4 LCD and it runs for hours. I have two serial ports & some other I/O and it all seems to be just fine. It's just retaining RAM contents thats not working.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 12, 2023 11:08 am 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
Dr Jefyll wrote:
8bitPogle, it caught my attention when, near the beginning of your post, you said, "when I just wired up a little test (with no ICs) , the voltage out was pushing 7v." I assume you were expecting 5 volts (or close).

Be aware that, although most power supplies will maintain their rated output voltage even when no load is present, there are some for which this isn't true. :!: They require a certain minimum load (ie, that a certain amount of current, listed in the specifications, be drawn). If you fail to draw at least this minimum amount they can lose regulation and output more than the expected output voltage. It sounds as if this may've happened to you. :|

Your best option, IMO, is to simply stop using that power supply! :shock: Otherwise, I suggest you find out what minimum load it requires and permanently attach a suitably sized resistor as a dummy load which will draw (and waste) that specified minimum amount. (Let us know if you need help determining the resistance and wattage of the resistor.)

I can't help wondering if this minimum load issue has affected some of the other observations mentioned later in your post!

-- Jeff



Hi Jeff
Thanks for that - interesting point that I wasn't aware of.
I'm not really sure what output voltage I was expecting, but the 5v and 3v supplies are sort of in parallel, so I assumed it was something to do with that and the diodes preventing the supplies trying to 'level out'.
I have attached a small picture of the battery circuit.

Re minimum load, I suppose I could connect the old Sonos bridge that the supply was designed for and see what it's drawing and work it out from there?

I have used that supply for quite a few breadboard computers, but I get what you say about using it for small experiments...more stuff to learn :D


Attachments:
batteryCircuit.png
batteryCircuit.png [ 19.51 KiB | Viewed 1354 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 12, 2023 11:18 am 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
Rob Finch wrote:
Just looking at the specs for AS6C1008 it says the data retention voltage is 1.5v. At 3V the device could be operating - the operating range is 2.7 to 5V. If CE is tied low won't the RAM be enabled?


Hi Rob

Thanks for the response.
Yes - that's what the datasheet says, but it also says it is 'is well designed for very low power system applications,'.
When using the DS1210/1321 I just get what the NV controller supplies, so I don't really have any say over that voltage.

re the /CE line, the chip has two enables - /CE and CE2, and my control logic is using CE2 so I believe I'm OK just tying /CE to ground. It all seems to work just fine, with the The chip enable effectively controlled by the CE2 line. (Is that an invalid approach?)
When I added the NV controller, I thought I might as well use the write protect feature so routed the grounded /CE connection via the /CEin /CEout pins on the NV controller.
Whether this aspect of the controller is connected or not, I still get the same behaviour, though.
Hope that's a bit clearer :D

What I should have said is that apart from this weird ram contents being set to all 0x00, everything works as expected. Serial comms, small LCD etc - all happily runs for hours.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 12, 2023 7:35 pm 
Online

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 989
Location: Potsdam, DE
You may need to tie your remaining (positive) CE2 line to ground with a highish value resistor; at a guess, 100k or so, to make sure that it isn't driving itself to its active high when the main power is removed.

Neil


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 21, 2023 6:27 pm 
Offline
User avatar

Joined: Fri Dec 03, 2021 2:54 pm
Posts: 11
I finally found out what was causing the problem. It took quite a while - I thought the issue may have been time related, so was testing RAM contents after overnight waits etc. I also wondered if I had some kind of wiring problem, so rebuilt the entire system with a different, neater breadboard layout. It’s been a hugely frustrating experience, but – having asked about it on this forum - I thought I would share my experience in case it ever helps anyone else.

Firstly, I created a ‘minimal’ program with a lot of inline code rather than subroutine calls which just initialised the ACIA and then offered the option to read or write memory to a series of predefined locations. Having written memory, subsequent reads after power down/up were always showing expected contents (no NULLs), irrespective of elapsed time or number of power ups/downs.

Consequently, I became more convinced it was something to do with my code rather than being somehow hardware related. I amended my initialisation routine so that it hex dumped some specific areas of memory on power up. This meant only my initialisation code would run before I could check memory – no command line interaction or other code was being executed before the memory dumps.
Capturing and studying these dumps, I eventually identified that the NULLs always started from a bit of memory I had allocated as a 30-character input buffer for characters input via the 6850 ACIA. As a test, I relocated this buffer in my memory definition and, and – sure enough - the NULLs subsequently began at wherever the new input buffer memory location started. Very significant, I thought.
My minimal program didn’t use an input buffer – it just checked any character captured for ‘r’ for read or ‘w’ for write and discarded anything else, so I now knew it was something to do with the command line processing.

But, I still had the issue that something very random appeared to be triggering when the NULLs turned up, and also how much memory they actually filled. It was always a lot of memory, but could also sometimes be almost all the available RAM.

A serendipitous appearance of NULL’s directly after I noticed I had connected my USB-FTDI cable while the system was powered up, led to a further bit of investigation. I subsequently confirmed that the NULLs appeared if I connected or disconnected the UBS-FTDI cable while my breadboard system was powered up. i.e they did NOT actually appear on system power up or down after all

So, now I had a pretty good hypothesis. – It looked like ‘noise’ manifesting as a stream of NULLs was being generated whilst dis/connecting the USB-serial cable if the system happened to be powered up.

I didn’t have any bound checking on my ACIA fill routine, and so what was happening was the buffer was being overrun with thousands of NULLs which would fill up an undefined amount of memory. (Slight confession here – this is a Z80 build. I had never used nor programmed a Z80 and wanted to see how it worked compared to the 6502 and so I was using a 16 bit register for the input buffer index). If the buffer was in high in memory, it would ‘run over’ ROM in low memory (with no effect) then and start trashing lower memory. If the buffer was in low memory, NULLs would fill up to varying upper limits. With a 16 bit index, it could loop the whole 64K if enough NULLs were generated.

So, a combination of no boundary checking on the ACIA input buffer AND the unexpected generation of huge volumes of NULLs when dis/connecting the USB FTDI cable if the system happened to powered up first, was the source of my apparent random filling of memory with NULLs. If this happened BEFORE I finally powered down, then the NULLed memory was being preserved by the DS1210 NV controller. If I happened to connect while the system was powered up, then whatever was preserved in RAM before power-up was being overwritten by NULLs.

If I hadn’t been checking RAM contents to check my NV controller was working, I wouldn’t have ever noticed any of this, as it made no difference to ‘normal’ operation 
So there we are!


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 22, 2023 3:48 pm 
Offline
User avatar

Joined: Sat Jun 08, 2013 4:02 pm
Posts: 46
Shouldn't that EDN circuit have at least one more diode? Looks to me like when power is off the battery would be powering everything on the 5V line. What am I not understanding about that method?

Here's another scheme which I think came from EDN, but I'm not sure. I don't have the text that goes with it.
Attachment:
battery.gif
battery.gif [ 19.46 KiB | Viewed 1125 times ]

http://forum.6502.org/download/file.php?id=1349&t=1

_________________
"I am endeavoring, ma'am, to create a mnemonic memory circuit... using stone knives and bearskins." -- Spock to Edith Keeler


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 22, 2023 5:40 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
richardc64 wrote:
Shouldn't that EDN circuit have at least one more diode? Looks to me like when power is off the battery would be powering everything on the 5V line. What am I not understanding about that method?

No; when the power is off, the transistor will be reverse-biased and will not conduct.  The base-to-emitter breakdown voltage, which is the lowest of the breakdown voltages, is always a few volts more what it will get here, so it's essentially an insulator.  The SRAM's Vss pin has no direct connection to the other ICs' Vss pins, so the diode won't power the other ones.  It's true that there will be ESD-protection diodes in the SRAM, with their anodes toward the Vss pin and their cathodes toward the signal pins, so the signal pins can't go much below Vss; but those will be reverse-biased now too.  At the other side, there will be ESD-protection diodes from the signal pis to VDD; but those won't have any voltage on them to turn them on.

Quote:
Here's another scheme which I think came from EDN, but I'm not sure. I don't have the text that goes with it.
Attachment:
battery.gif

http://forum.6502.org/download/file.php?id=1349&t=1

That one would not allow the VDD pin to come up very close to the full 5V, even if they were Schottky (which they're not shown to be in the diagram).  It'd probably come up high enough to operate under most conditions, but it wouldn't be in spec.

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 36 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: