Close

SRAM - problem

A project log for PIC MCUs Based Homebrew Computer

The goal: to make a working computer, with a keyboard input, LCD Display output, a compiler and to have fun all the way. NEWBIE ALERT

davedave 02/06/2015 at 23:527 Comments

So, today I ran into a problem with my SRAM. It works fine, just not always. For some reason, everything freezes on times, when accessing ram.

Here's what I mean.

I have 0123456789 written in my ram. I read it 5 times in a row and print it on screen.

This is when everything goes right:

This is when it *almost goes right*:

(it never outputs the last 8 and 9)

And this is just an utter failure:

I've spent my whole day debuging it. I really want to have the SRAM module a part of my computer. But it seems that it just may happen, I will have to use eeprom instead,.. after all.

This is how it works with EEPROM instead of RAM.

Any ideas or tips?

Discussions

dave wrote 02/07/2015 at 02:37 point

You're very welcome :). No unfortunetly there's almost no code. Because the mcu that is for now simulating a cpu is just testing parts of the computer. I stripped it off of any functionality but S-RAM and LCD (I thought some thing could get in the way with ram). I was affraid that my databus protocol had a bug (would explain the freezing, plus it would mean that the same thing could happen at any time with other components), but then I tested every other part (they all use the same protocol) on a huge scale, there was no problem, not one. I have one more thing I can do and that is, to rewrite how control signals of SRAM are sent, and go through the datasheet of the sram chip. I'll do that tomorrow, if this doesn't work, then I may as well give up on ram chip..

Well, now that I am writing to you, I'm thought of one more thing to do.. Maybe it's the voltage problem. I do use a 330 ohm resistor on the VDD of the chip. I will recalculate the voltage and read the datasheet again. If this works, I owe you a beer.

The bottom of it is, I'm not giving up just yet. If I do.. I'll just go with eeprom. It works fine actually, it's even fast enough, but I really wanted SRAM, because it's cool. And I cannot believe that in my country of sLOVEnia is impossible to get a SRAM that works with I2C. That'd save all my problems.. I could buy it over ebay, but if that is the only way to get it, then my computer will just have to wait for it until everything is done, because I'm slowly getting sick of this Static - Random Access Memory.

It was real nice talking with u. :) Have a wonderful day.

  Are you sure? yes | no

DainBramage wrote 02/07/2015 at 04:59 point

Is there any reason (other than the cool factor of the S-RAM) not to go with the EEPROM?

I'm curious to find out if the resistor is the cause of your troubles. It would be nice for you if it turned out to be something that simple.

Have a nice day also, and good luck with the RAM as well as the rest of this project.

  Are you sure? yes | no

dave wrote 02/07/2015 at 08:25 point

Yes,there is. another reason. EEPROM is limited to number of time data can be written/erased. 1,000,000 times. RAM is rather busy chip, but now that I think of, I think 1,000,000 could be okay. I should do some math. Thanks for encouragement.

  Are you sure? yes | no

DainBramage wrote 02/07/2015 at 00:46 point

Is it possible that the memory location of the last 8 and 9 characters is being accidentally overwritten somehow? I've run into similar issues with Arduino sketches, though the circuits for those were orders of magnitude simpler than your project. In my case it was a single mis-written line of code that caused my display to freak out.

  Are you sure? yes | no

dave wrote 02/07/2015 at 02:02 point

Hello Dain Barmage.
Thank you for your feedback. I'm very glad. I really appreaciate your help.
I am using only one address for now. This is how I am testing it:
I write a first character at an address 0x00, then I read it (testing
reading), then I display it. Then I move to the next one and do it all
over again. I tried changing address for each one, but the same thing
happen. I tried everything I can today. I even changed the memory IC
(just in case something was wrong with it), the same thing.



I just uploaded my post, it now has a video of how it should work. I'm using eeprom in the video, that's why it's working.

And seriously, thank you for your reply. I hope I can make it work. Otherwise, I'll just have to go with eeprom.. but then this all was such a waste of energy and time. Well.. at least I learned something, an that is: Test SRAM as a whole not just as a bit.. and other great old Chinese sayings. (Love your nickname by the way)

  Are you sure? yes | no

DainBramage wrote 02/07/2015 at 02:08 point

Is there anything else in your code that might be overwriting that memory address without your knowledge? In my case I had failed to initialize the variable properly and the last two bytes were being shared with other parts of the program.

Unfortunately, I am really not all that good at programming. You are light-years ahead of anything I could do. However, what you described reminded me of the issue I had with that sketch so I thought I'd share it with you in the hope that it might be helpful.

  Are you sure? yes | no

DainBramage wrote 02/07/2015 at 02:09 point

Oh, and thank you for the compliment about my nickname. :)

  Are you sure? yes | no