I did some more debugging over the weekend. The thing to investigate was why roms crash or hang when music starts. That was the last suspicion we had on thursday.
So mukunda from #snesdev helped me and made a few test roms to investigate the problem with the SPC. First we started with a simple test to find out that during the SPC boot the system stalls. So it was verified, that music triggers the problem.
I learned that the system needs to read back $2140 and $2141 to get the SPC status. So where software will wait for $AABB in that registers. I suggested to mukunda to add verbose debug printing on the display to see the register status. Also he added color flashing of the background so see if the snes crashes or just idles on the register poll.
So it came out that the register always reads $2121, which is an openbus. Made a video from that tests:
So i suspected that there is something wrong with the CART/CS line, because it looks like the rom doesn’t get deselected.
Background to this is that MMIO access of the register $2140/2141 make the address appear on the A bus. RD will go low and CS will go high for deselecting the rom. This should activate the SPC on the A bus. So i made a little logic analyzer session with the prototype board to verify this. The outcome looked quite ok.
Next day Max joined me debugging and i explained him that we have a conflict on the A bus during MMIO. Going thru the schematics we figured out that the only weak spot could be the busdriver which forwards the CART IO line and switches the ram address and data bus to the SNES A bus.
So Max added another OR gate to get better control over the CS line. What we needed was this:
CS: Cart ( low active ) EN: SNES enable from avr G: Busdriver enable CS EN G -------- 1 1 1 0 1 1 1 0 1 0 0 0
Since i didn’t had anything better than an 74LS00 at home, we did it with 3 AND gates. And this did the trick. Now we were able to boot roms which used the SPC. So we think the problem was that the budsriver was soaking up too much voltage, when the SNES was pulling CS hi the SPC didn’t got triggered.
After running a few games, we found that that now he have random crashes somewhere else 🙁 Have to investigate this right now…
- Loose connections
- SRAM timings
- Memory corupptions