infiniteimprobability wrote:boundary of 2,097,188 bytes just before things begin to alias
But 2 x 1024 x 1024 = 2,097,152
So surely it wraps at this point, which is 36 bytes before your observed wrapping.
Something doesn't quite add up here as I would expect it to wrap at 2,097,152!?
At first I though it was aliasing at the bank boundary, but it looks like it is some where in the middle there. I have run the same test bed with our other prototype board which uses the Micron chip and I'm seeing the same results.
Like I said before, if I write 2,097,188 bytes I can read it back and everything is bit perfect. Adding an extra byte for a buffer size of 2,097,189 byes results in a mismatch of the first byte read back. That first sample is identical to the last sample that was written to sdram.
Armed with this knowledge I can verify very easily that there is some aliasing occurring which is either causing my writing to overwrite samples in sdram or my reading to reference the wrong areas of memory. For reference, I am writing a sine wave of 8-bit samples where one full cycle occupies the entire buffer.
This represents the write buffer and is what I expect to get back after a read operation:
If my write buffer is 4,194,376 bytes (exactly double the magic boundary) my read buffer looks like this:
As you can see, the negative cycle is perfectly mirrored. It looks like during the write operation, the positive half of the wave is getting overwritten with the negative cycle. Then during the read operation, the entire buffer is being read back that way too.
The way my test bed differs from the benchmarks I've seen distributed with the sdram library on github is that the benchmarks are run and memory is allocated in small chunks entirely on the chip. I am sending these large buffers from the PC to the processor over USB and the entire buffer is being written and read separately. Therefore write/read verification that take place on the example benchmarks happen in small chunks. That kind of testing would not catch this kind of issue.
Do you have any ideas on what to look for?