The SOCoCo-80 Project |
|
A Possible Eureka Moment |
|
Big Indian Little Indian – Why slap my Papoose! |
|
I think I have an answer to the Dynamic RAM write problem. This is going to get complicated and it hasn’t been verified yet. But, it looks to be a very curious and possible solution.
Let me first explain the problem. The driver that I’m using for the DRAM was written by another. The data transferred is in 32 bit wide segments. To discriminate the data into an 8 byte data segment I used address lines 15-2 for the DRAM address and A1-A0 to pull out the 8 bit data (4 8 bit blocks in a 32 bit data word). This is simple enough and assuming the driver works as I thought, all would be well.
But, what I was getting was data coming in in places where it shouldn’t be in th 32 bit field. For instance trying to read data bits 16-23 would read back on bits 8-15. Things weren’t coming back correctly. I thought I found a solution on the read function by re-sequencing the data read in a case statement. This worked fine but I still couldn’t explain it. When I got to the write function, things really got strange. I was reading data that wasn’t even in the blocks I was reading in. Then when I wrote the data out, it was in the wrong locations. Arrrg.
|
RTFM – Read the F’ing Manual |
|
I had some free time today so I glanced at the datasheets for the Dynamic RAM on the DE-1 board. I found that the original author was using a 2 word data burst mode. This means that 2 16 bit data words will appear on the bus in a 2 clock sequence. Now here’s the kicker. In 2 word burst mode the A0 bit determines the order in which the data comes in sequentially. Since I’ve been sending A1 from the CPU as A0 to the RAM, the burst would change the order of the data every other word.
OK, I know this is complicated but now that I see this, it makes sense. This also explains why in the original authors test code he/she increases the address by 2. This forces the A0 to always be at zero (reset starts the address at 0) – All even addresses.
The fix would be to fix A0 to 0 in my address pass to the driver. This needs to be tested but we’ll see. If this doesn’t work, I’m going to change the driver initialization to use Burst mode 1 which sends one 16 bit word at a time.
..and away we go --- TESTING!!!! Wooo Hoo
|
|
|
© 2013 – Franklin Laboratories |