gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > dma xor'ing data ?

#149175 - PypeBros - Wed Jan 16, 2008 10:42 am

I was moving around datas between the main memory and VRAM using DMA lately, and during a debugging process, it suddenly started to go wild.

Rather than doing "normal" copies, the DS started to "overlay" past content and new content such as if a 'OR' or 'XOR' function was applied between them. Several updates of the software didn't fix the thing, but restarting the console did.

My guess is that i may have touched some DMA configuration bit that i don't reset in my initialisation code, but then, gbatek does not document any kind of "copy-and-combine" dma transfers (afaik).

Has anyone else ever experienced something alike ? If properly controlled, it could get handy for people working e.g. in bitmap mode (font rendering coming directly to mind)
_________________
SEDS: Sprite Edition on DS :: modplayer

#149180 - thoduv - Wed Jan 16, 2008 1:11 pm

Has you been able to reproduce the behavior ?

#149181 - Jim e - Wed Jan 16, 2008 1:20 pm

PypeBros wrote:
Several updates of the software didn't fix the thing, but restarting the console did.
You're saying that restarting the console fixed it. Are you sure video memory isn't somehow overlapping?

#149198 - PypeBros - Wed Jan 16, 2008 5:32 pm

@thoduv: unfortunately (?) no, i haven't reproduced it. I mean, not since i power-cycled the console. I suspect it appeared due to invalid lengths submitted to dmaCopy(), resulting of some data corruption ...

My software works in the following way: it can get a new copy of itself over HTTP and stores it in a file before it performs a software reset and have the freshly updated software loaded again in memory. That's what i did several times. The same copy of the software stop showing the bug after i power-cycled the console.
_________________
SEDS: Sprite Edition on DS :: modplayer

#149257 - simonjhall - Thu Jan 17, 2008 10:16 am

Could be a cache thing? Wouldn't give an xor effect, but the DMA system might get the crap that used to be in memory before the data cache was written back.
DC_FlushAll before DMA = teh friend.
_________________
Big thanks to everyone who donated for Quake2

#149267 - Jim e - Thu Jan 17, 2008 3:36 pm

simonjhall wrote:
DC_FlushAll before DMA = teh friend.
Kinda spoils the whole point of dmacopy then. Though it is a good way to see if thats the issue.

I've heard of the bitwise or problem, it was due to mapping vram banks to the same spot. It would fix itself if you reset all the banks.

Do you have any more symptoms or example code?