SX52 and SRAM problem...kinda long
cbmeeks
Posts: 634
I am working on a color NTSC video circuit using assembly and SRAM (32k).
I am having some strange problems that seem to be getting the best of me.
First of all, my setup:
SX52 @ 80MIPS
rc = video bus
rb = data bus (for SRAM)
rd/e = 15 bit address bus (parallel)
ra = misc control
Now, here is what I am doing. Just for SIMPLE testing, I am only using the first 256 bytes of the SRAM. I set port RD and RE to all 0 which I assume is address $0000
RD is wired to A0 - A7 and RE is wired to A8 - A14
When the scanline starts, I set the address bus to all 0 ($0000) and I increment port RD. Then, the raster grabs the new value from SRAM and blits it to screen. A framebuffer really. This should give be 256 bytes...one for each of the 256 pixels.
I copy the databus directly to the video bus.
In the beginning, I clear out the SRAM (the entire 32k) so that I don't have garbage.
Now, here comes the fun part. Let's say I clear the 256 bytes with a blue background and nothing else. This works. On the TV you see my blue. Now, lets say I change position $0002 to have a white pixel. This works. Now, if I add another pixel, it works but it takes the original pixel and duplicates it randomly on the screen!!! It's hard to explain.
At first, I thought 256 pixels was just too much. So, I reduced it down to 16 pixels (fat pixels!).
Still the same problem.
Maybe this can explain it better:
Hope this makes sense.
Thanks!
cbmeeks
I am totally stumped on this one. I am using 15ns SRAM so I was careful at making sure there was enough delay between setting up the address bus and reading/writing to the databus.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks
Post Edited (cbmeeks) : 12/21/2005 9:48:44 PM GMT
I am having some strange problems that seem to be getting the best of me.
First of all, my setup:
SX52 @ 80MIPS
rc = video bus
rb = data bus (for SRAM)
rd/e = 15 bit address bus (parallel)
ra = misc control
Now, here is what I am doing. Just for SIMPLE testing, I am only using the first 256 bytes of the SRAM. I set port RD and RE to all 0 which I assume is address $0000
RD is wired to A0 - A7 and RE is wired to A8 - A14
When the scanline starts, I set the address bus to all 0 ($0000) and I increment port RD. Then, the raster grabs the new value from SRAM and blits it to screen. A framebuffer really. This should give be 256 bytes...one for each of the 256 pixels.
I copy the databus directly to the video bus.
In the beginning, I clear out the SRAM (the entire 32k) so that I don't have garbage.
Now, here comes the fun part. Let's say I clear the 256 bytes with a blue background and nothing else. This works. On the TV you see my blue. Now, lets say I change position $0002 to have a white pixel. This works. Now, if I add another pixel, it works but it takes the original pixel and duplicates it randomly on the screen!!! It's hard to explain.
At first, I thought 256 pixels was just too much. So, I reduced it down to 16 pixels (fat pixels!).
Still the same problem.
Maybe this can explain it better:
Now, I am only using *16* pixels address $0 to $F B=BLUE W=WHITE This works: 0123456789ABCDEF BBBBBBBBBBBBBBBB Produces a solid blue line This works: 0123456789ABCDEF WBBBBBBBBBBBBBBB Puts a white pixel at the front This works too: 0123456789ABCDEF BBBBBBBBBBWBBBBB A single white pixel (at $A) works. A single pixel can be anywhere. This does NOT work: 0123456789ABCDEF WBBBWBBBBBBBBBBB Two white pixels. One at $0 and one at $4 On screen, it looks like this: 0123456789ABCDEF WBBBWBBBWBBBBWB You'll notice the extra white pixels. This only happens when I plot more than one pixel (other than the background)
Hope this makes sense.
Thanks!
cbmeeks
I am totally stumped on this one. I am using 15ns SRAM so I was careful at making sure there was enough delay between setting up the address bus and reading/writing to the databus.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks
Post Edited (cbmeeks) : 12/21/2005 9:48:44 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Not 100% sure what you mean by the cycle time. I am new to SRAM.
I have the code at home and will post some tonight. But basically, it something like:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
As a sanity check, try slowing down access to the SRAM. Or is that what you did when you did 16 pixels ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Forget about the past, plan for the future, and live for today.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Here is a direct link to the datasheet:
jameco.com/wcsstore/Jameco/Products/ProdDS/75037.pdf
Here is some code:
I will do the LED tests next and post my results.
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks
To register the value, the write line has to go low for the specified 9 ns minimum, and *must* go high again to clock the data into the memory array.
With reads, the data sheet specifies that you can get away with putting CE and OE low and reading new data by changing just the address.· You just can't change the address any faster than every 15 ns.· But that should work OK.· You·have to wait the required access time of 15 ns before reading the data, because it isn't guaranteed to be there before that.· The data hold time lets you read the data at the same time as you change the address, but since you are reading the data long after you change the address,·you don't need the two nops between the mov VID_BUS, DATA_BUS and the inc ADDR_BUS_LSB.
To write, you have to put CE low, OE high is optional, but then you have to bring WR low and then high again before you switch addresses and data.· See note 10 in the specs on page 6, CE or WE must be high during address transitions.· So if you are setting them both low, then doing your plot macro, I think all bets are off as to the data that ends up in the ram, and where it ends up.· If you leave OE high and make CE low while writing you can set·the address, output the data, bring WE low, wait at least 9 ns then bring WE high, and do it over for the next byte to write.
Should be a simple fix, and you will have beautiful pixels wherever you want them on the screen. [noparse]:)[/noparse]
MRC
·
Make sure you have proper caps as close as possible to the SRAM, and that your supply can handle the current needed.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Forget about the past, plan for the future, and live for today.
·
I would ignore using the /CE pin, and just tie it low, unless you are using multiple SRAMs (or using other devices on the same bus), theres no point using it, it just slows down the access.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Man, I believe that is it! I will try it this weekend...as soon as I remind Santa how to get to our house. ;-D
But I get what you are saying. I simply am not cycling correctly (or at all). I *assumed* all you had to do was set the address you want, wait 15ns, send the data and that was it. Looks like that is OK for reading but not writing. All of my writing will be done during VBlank so super high speed shouldn't be a problem. In fact, a 6502 will be responsible for the writing.
Yup. You can't see it in the pic but I have two caps within mm's of the powerpin.
You know, I actually thought about that. Eventually, the SRAM will be shared with a 6502 and maybe even ANOTHER SX (for sprites). But all that might be OK because only one would use the data/addr bus at any one point.
Plus, I am using an SX52 now because that is what I have. The final product will use an SX48
cbmeeks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com
=========
DMCA Sucks
RIAA Sucks