Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 22, 2011, 09:03:51 pm
One thing that I notice is that you dont configure all your pins in the first lines of code, but rather set some enable lines and only then you set all the pins to the desired state.
Do you thing it could be important ? I mean, I thought the more important was to set Chip enable/Write Enable and Output Enable to HIGH asap, so as to disable chip writing.
What I'm thinking of is:
- when the Arduino is resetting and the power is going up, is it possible that the Write pin of the memory receives a logical LO ?
I mean, if I use a pull-up resistor on Write (to avoid RAM corruption), both signal should go up from 0V to +5V (when power rises).
But since the Write pin is connected through the resistor, its voltage should be lower than VCC ? should it be?
(the arduino's VCC is connected to both memory's VCC and Write Enable through resistor - as a pull-up resistor).
Is it possible that when the VCC pin gets enough power to start to work, the Write enable is still UNDER the logical HI state ?
I don't have an oscilloscope to check that, I've built a poor man's one, with another Arduino, but I managed to fry one of my USB ports on
my laptop !  smiley-confuse
And it's rather slow, a few kHz if I remember well. Don't know if it's enough...
2  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 22, 2011, 08:41:17 pm
Big woops, I only have an duemilanove, so I dont have enough pins to test it :/
Well, you don't have to use all the address pins, as long as you ground unused ones.
In my tests, I have used pins A0 .. A10, but on some tests I used only pins A0..A3 for
example.
3  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 10, 2011, 07:14:03 pm
I have one of those chips at home, I could try it.
Show me your code.
Hi, thank you, that's nice of you.
I've attached the code.
Just a short explanation of the wiring:
- I use 11 pins from the NVRAM (A0..A10). They are connected to pins 53, 51, 49, etc, on the arduino (eg, A0 is connected to pin 53, A1 to pin 51).
- data pins (D0..D7) are connected to pins 38,40,42, etc.
(address & data pins are in reversed order, it was just easier to wire... the "stepa" & "stepd" vars take that into account)
- pin 12 is for a push button, to allow to write again the nvram with correct data (ie memory = i & 0xff) if pushed within 4 seconds at start
- pins 22, 24 & 26 are for the chip enable, output enable and write enable pins.

BTW, my arduino is an ATMega.

Thank you for your time again...
Boz
4  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 09, 2011, 08:05:59 pm
Use 3 10kOhm resistors its enougth to calm it down, and put one in each enable line, to connect them you put one end of the resistor in each enable line and the other end connects to 5v.
Well... I've tried everything for several hours, and it's still not working... I'm feeling a bit lost. smiley-mad
Adding a resistor definitely drops down the amount of corrupted bytes, but some always remain...
And it doesn't matter if I pull up OR down the enable lines ! It doesn't change the amount of
corrupted bytes (I thought that pulling down the enable lines would result in a large amount of memory
corruption, but no, nada...). I've checked no voltage (0V) on the resistor with my voltmetter, during the reset phase. Is it normal ?
When I directly connect Chip enable & Write enable to GND (and disconnect them from arduino),
nearly the whole memory gets corrupted on the next reset. When I connect them to VCC, no corruption
happens at all. So I still think this is a good track to follow...
I've also tried higher resistor values (120 K) and lower (220 ohms). Nothing changes at all...
What could go wrong ?

Boz
5  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 09, 2011, 10:44:36 am
Use 3 10kOhm resistors its enougth to calm it down, and put one in each enable line, to connect them you put one end of the resistor in each enable line and the other end connects to 5v.

OK, I'll test it tonite, thank you !

Boz
6  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 09, 2011, 07:17:54 am
You need pull-ups or pull downs in the enable lines so they dont float when your arduino is reseted.
Thank you for your answer. Could you tell me...
- As the 3 enable lines are active low, I think my best shot is to use pull-ups, to set them inactive, am I correct? (I know it sounds like a silly question, but I'm really a newbie !)
- What enable lines should I pull-up ? Chip enable only ? Write enable ? Chip enable + Write enable ? All 3 enable lines (chip/output/write) ?
- What resistor value would you advise me to use ? It's a basic 5V set-up, with just a chip or two.
7  Using Arduino / General Electronics / Re: NVRAM corrupted on reset on: June 09, 2011, 07:10:49 am
Quote
So, I have connected my arduino digital pins to A0..A7, D0..D7,

Which arduino pins are you using?  All of them?

Hum, I don't understand your question. I've connected pins A0..A7 (memory) to
digital pins 22..29 (arduino), if I remember correctly (I don't have the board in front of me),
and D0..D7 (memory) to 30..37 (arduino).
8  Using Arduino / General Electronics / NVRAM corrupted on reset on: June 08, 2011, 07:46:30 pm
Hello,
I'm using a 1Mbit NVRAM ZEROPOWER (http://fr.farnell.com/jsp/search/productdetail.jsp?SKU=1218170) as a ROM replacement
for a 8-bit CPU project.
I'd like to program it with my arduino mega.
For the time being, I only use the 256 first bytes of the memory (A7+ are connected to ground).
So, I have connected my arduino digital pins to A0..A7, D0..D7, Chip Enable, Output Enable and Write Enable (whatever
their name).
I have written a simple sketch, that stores X in address X, for X in 0..255. And then reads the memory, to check that the values
are ok. Then, I change the sketch to disable writing, and only read the memory and do the check part.
The problem is : after an arduino's reset, a few bytes are altered. After several resets, a lot of bytes are altered.
Sometimes, a value comes back OK after being wrong for several resets, which puzzles me... or maybe it is just a single bit that got back to its original value.
I think maybe the NVRAM inputs (the arduino's outputs) are unstable during the reset time, and so the Write pin gets enabled and the memory is written.
I've wired the Write pin to VCC : the content of memory isn't altered anymore after any RESET, so I definitely think that the
problem is here.
I'm a newbie in electronics, so I need some advice, because:
- I'd like to be able to program this NVRAM with the arduino
- and then, use it like a ROM/RAM for my 8-bit microprocessor
The datasheet tells to use:
- a 0.1 µF capa. between VCC and VSS
- a 1N5817 diode between VCC and VSS
I've only tested with the capa, which leads to massive data corruption. I didn't test the diode, I have to look for one.
I've tried with a 0.1 µF cap between VCC and Write pin : it works far better, just a single byte gets corrupted
once in a while. But it's not OK, I need it to work all the time and never get corrupted.

Any idea ?

Thanks.

Boz


 
9  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: June 08, 2011, 08:55:35 am
Hello !
Sorry for the long delay (delayWeeks(), a new Arduino function...  smiley), but
I was waiting for my Z80 - and other electronic stuff - from Jameco (which costed me 44 € for shipping PLUS
44 € for customs... ouch... never again !), and then I became father for the second time... So I'm just beginning
to have a little spare time for me again, before going back to work tomorrow (ouch again).
While waiting for the Z80, I made some tests with a 6502, and it worked perfectly. So, I've done the same tests
with the new Z80, and it works great.
- I've bought a 1Mhz oscillator, but it's too fast for the Arduino to keep up the pace, even with a basic test.
So I'm still using the Arduino as the source of CLK.
- The Arduino plays the role of an memory simulator (using the Arduino RAM for the Z80). For the time being,
I write my Z80 code and compile it on PC, then insert it into a byte array in the Arduino code.
(eg: char bytes[]={0x3E,0x20,0xD3,0,0x3C,0xC3,2,0};). Every time the Z80 requests a byte from memory, it is taken
from this array. Thank you Rob for the suggestion.
- It also serves as an I/O IC simulator : every time the Z80 outs a byte to 0, the Arduino sends it
back to the PC via Serial and then I can display it on my PC screen. I will use the same mechanism, in
the opposite direction, to provide a virtual keyboard to my Z80 computer.

Things I'd like to do now:
- use a real memory instead of the Arduino. Since I don't have an EEPROM programmer, I'm trying to use a NVRAM
but for now, it doesn't work (whenever I reset my circuit, some bytes - sometimes a lot- from the NVRAM get corrupted, don't know
why. Maybe a write occurs during the RESET with the WriteEnabled pin unstable ?). When it will work, I will set up a assembly chain,
so that I can write code on my pc, then assemble and download it into the NVRAM, with some kind of bootloader at the start of the
NVRAM (the Arduino will "listen" to IORQ queries on address X, and provide the data to the bootloader so it can write it into RAM - don't
know if I'm clear !?)
- use latches to provide more than 64 kbytes of memory (switching banks)
- connect a parallel 40x2 LCD display directly to the Z80, so it can output text by itself
- build or connect some kind of keyboard.
- connect some kind of mass storage. I've only a few ideas right now, like using the SPI interface of an SD-card.
- connect it to a VGA monitor. The tricky part for me, right now.
then...
- write an O/S (multitask would be great, but is it possible without hardware NMI ?) and maybe a compiler before (or use some kind of C compiler for Z80,
like SDCC)
- make it multi-processor
- etc, etc...
 
Well, that's a lot to do ! It will eventually require a few years...
Thank you again for your advices and help !

cr0sh : sorry, I did'nt have enough time to explain why I'm doing this.
- first, I didn't know you could still find DIP40 Z80 (I knew of the Rabbit one, but where's the fun ?)
- I'm not interested in repairing it to have it work (I've had a 6128 CPC Amstrad, in the 80's, and emulators are enough for me)
- it's really for the sake of the educational value : I've always wanted to design and build my own computer,
but I work in the software businness, which is a really separate world (when you don't work with embedded devices).
- I was sure the Amstrad was in bad condition. When people sell you this kind of stuff, at a very low price, and without
the power cord (because they "could'nt find it"), 99 % of the time it's because it's not working anymore.

Boz
10  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 11, 2011, 05:36:07 pm
Hello !

So, I've tried a new circuit, the Z80 test circuit from z80.info (http://www.z80.info/z80test0.htm),
to be sure that the Z80 was working correctly by itself, before going on.
And the result is... the circuit is not working. But I can't tell right now if it's the Z80 that's not working
or a mistake of mine, during the assembly.
A lot of heat, no LED on.... (btw, I assume that the Z80 can overheat even if it's broken. Is it right ?)
I've made a few checks with my voltmeter, and found some weird results : the resistors next to D0-D4 (or D3, not
sure) show something around 1V, the next one (D5 or D4) is 2.5V, and the remaining ones (D6-D7 or D5-D7) are 0V.
It doesn't seem right, but what can it mean, I cannot tell...
I've orderded a few Z80s from Jameco, because I don't know french shops that sell Z80s. So I'll have to wait a few
weeks maybe... (btw, do you know european shops, where shipping might be quicker - and cheaper ?)

During this time, I will try to do the same thing with a 6502 I've just received from eBay. I have more confidence
in it, so maybe I'll be able to make it work (even if it works differently, the clock for instance...).

I'll tell you as soon as I have any interesting results (w/ the arduino, of course!).

Bozgrul
11  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 08:21:29 pm
Well, MREQ is alway low (active), A0-A3 is always 1111...
Time to go to bed !

Bozgrul
12  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 08:03:44 pm
Hi.
It's very late, I've spent a lot of time trying to make that thing work,
but... it doesn't!
This is how I connected the whole thing: (sorry, didn't find time to draw
a schematic, and I have no dedicated software. Do you know good, open-source ones?)

- not connected:
A4-A15 (I only watch A0-A3)
/HALT,/MREQ,/IORQ, /RD, /WR, /BUSAK, /M1,  /RFSH
- to Arduino 5V :
Vcc, /INT, /NMI, /WAIT, /BUSRQ
- to GND:
Vss, D0-D7
- to arduino:
CLK, /RESET, A0-A3

When I power this on, without any resistor before GND, the CPU overheats
very fast (even if I clock the CPU at 1 Hz... it seems strange to me), and I unplug
it 'cause I'm not sure it won't break.
If I use a resistor, it takes time to heat, but enventually will. And it doesn't work the same.

My sketch is the following :
setup :
set arduino clk & reset to output, arduino A0-A3 to input
reset <- low
clock <- low
every 500 ms, switch the clock output from low to high or high to low
after 3 s, reset <- hi
read A0-A3. if result is different than previously read, display.

When I use a resistor, I've got a fixed 1111 result from A0-A3.
When I don't, it alternates very quickly between 1111 and 0111. (faster
than the clock). But I didn't think of MREQ, maybe I have to check its
value too before displaying A0-A3.

So, still I'm stucked... but I go on searching.
BTW, Rob, thanx for the http://www.z80.info website, I think I will try to
setup the minimum Z80 CPU test circuit (http://www.z80.info/z80test0.htm),
seems a good way to find if the CPU is still OK, and if there is any problem with
the heat...

Time to sleep, I will just try the MREQ thingy before (or I won't be able to sleep!). See ya.

Bozgrul
13  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 08:25:02 am
Rob, that's exactly what I had in mind.
In fact, I read a blog page a few days ago,
where the author gave good explanations about the Z80.
And he did the same page about the 6502 (I'm expecting one,
bought on ebay) but explained the difference, because of dynamic  registers.
(http://www.reocities.com/SiliconValley/2072/z80proj1.htm)
"... It is worth noting that the Z80 is the only major computer CPU in the history of microelectronics that does not use any dynamic registers. Dynamic registers function much like dynamic RAM (DRAM) in that they must be constantly refreshed, or they lose their contents. Virtually every other CPU that was widely used, from the 6502 to the 80x86 family, uses these dynamic registers, and so they have a minimum clock speed which must be maintained for them, or their dynamic registers will lose their contents. The Z80 is so stable that it can actually be stopped at a standstill and still not lose its data. In fact, you can even set up a circuit to hand-clock it with a push-button switch. (If you do so, however, you must connect the button to the clock input pin through some stabilizing circuitry so that it produces a clean rise and fall, instead of a ragged, unsteady rise and fall.) ..."

I didn't find this site (http://www.z80.info/) before, even if I have searched a whole lot of ones the last few days.
Looks promising!
14  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 07:41:24 am
I'm talking about the Z80 of course, no offense.
But maybe it's a joke !?  smiley
Sorry, english is not my mother-tongue.
15  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 07:30:12 am
Thank you for all your answers that I read really carefully.
Who said that no one is interested in such oldies? Not me !  smiley
I will try again tonite, and follow your advices:
- use a real square signal for the clock (but at soon as I will get it
working, I will try changing clock parameters to see how the Z80 performs
under different clock signals or even manually - with the anti-rebounce)
- bind D0-D7 to GND to permanently send a NOP opcode (brillant idea, I feel stupid that I didn't have it before you tell me!)
- keep the design as simple as possible. I still have a few outputs of the Z80 that I can discard for now, I will care latter (WR or IORQ for example, since I will only read the whole memory)
I will take more time tonite to answer you, when I'm back at home.

Bozgrul
Pages: [1] 2