nesdev.com
http://forums.nesdev.com/

How to debug custom sd2snes fw? (Possible n00b question)
http://forums.nesdev.com/viewtopic.php?f=12&t=16732
Page 1 of 1

Author:  kmeisthax [ Thu Nov 23, 2017 3:23 pm ]
Post subject:  How to debug custom sd2snes fw? (Possible n00b question)

Some context first: I am busy attempting to add SPC7110 support to the sd2snes firmware. I have gotten to the point where I have everything but the Epson RTC implemented. I also had to alter the MCU firmware to load the SPC7110 FPGA bitstream file, which I placed on the SD card alongside my custom firmware.img. It boots normal games just fine, but any (non-RTC) SPC7110 software fails to load. It doesn't even crash. It just hangs at "Loading..." forever.

I would like to be able to debug the MCU firmware somehow, so I can see which step is actually hanging the MCU. I noticed the sd2snes cart has a mini-B USB port present, so I plugged a computer into it, but nothing seems to appear on the port. Is there something I am missing? I would assume it would provide at least a serial adapter interface for reading all the printf messages.

For the record, I have pushed all my code onto this branch of my fork. The only other change I made to the MCU firmware was building it with ARM's own GCC toolchain, instead of the one recommended in the readme, since I wasn't able to get that toolchain to build on Windows or Ubuntu. I'm under the assumption that if there is some kind of serial debug functionality in the MCU firmware, that it isn't particular to the snowcat.de provided toolchain.

Author:  qwertymodo [ Thu Nov 23, 2017 4:18 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

I'm pretty sure ikari has said that the SD2SNES's built-in RTC is actually based on the SPC7110, so you can probably use that instead of reinventing the wheel...

Author:  kmeisthax [ Thu Nov 23, 2017 6:22 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

Well, that'll help out a bunch once I get the MCU to actually load the new FPGA config...

Author:  Optiroc [ Fri Nov 24, 2017 10:40 am ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

Have you tried to get in touch with ikari_01 about it? I’m sure he’d be happy to help with getting this addition to a releasable state. He’s usually around in #snesdev on IRCNet.

Author:  redguy [ Fri Nov 24, 2017 3:40 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

There's a 14-pin bus on the side of the sd2snes (next to the battery). 3 of those pins are the UART output where the firmware printf output goes to. You can solder in a header and get a 3-wire UART to USB cable to view the output in a serial terminal. 3-GND, 6-RX, 7-TX. Hopefully the attached picture helps. It probably won't be a problem for what you are doing, but the printf code is not reentrant which can cause issues in the interrupt handlers.

The USB port isn't clocked/enabled in the current 0.1.7x firmware.

Attachments:
sd2snes_uart_connections.jpg
sd2snes_uart_connections.jpg [ 198.61 KiB | Viewed 1873 times ]

Author:  kmeisthax [ Sat Nov 25, 2017 2:24 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

Thanks a ton redguy, I'll try those UART pins next time I get a chance with a soldering iron. Wonder why the USB port is even there...

Author:  redguy [ Sat Nov 25, 2017 3:01 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

I recall seeing something about loading the firmware over JTAG using USB when reading through the source. Maybe that's how it was done before the bootloader supported it from the SD card.

There is a custom firmware that enables the USB port and adds some features:
viewtopic.php?f=12&t=16720

Author:  kmeisthax [ Sun Dec 03, 2017 9:31 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

So, I haven't got a chance to find a UART cable yet (I'm worried about getting a fake one and then it getting bricked by FTDI) but I did notice the MCU firmware actually does use the LEDs as a 3-bit error output when FPGA errors occur. Specifically, it's the LED_PANIC_FPGA_DEAD pattern, which fires if the FPGA fails to return the correct test token over the SPI bus. I audited all my changes to main.v and it turns out I was a *little* more overzealous when getting rid of bsx/dsp and accidentally removed some of the cheat outputs, which I guess broke SPI? Adding them back in means that I'm now greeted with a failing SPC7110 test ROM when I load an SPC game (everything reads NG), but that's better than the MCU not starting the game at all.

Author:  redguy [ Mon Dec 04, 2017 9:27 pm ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

The cheat module and associated $200B snescmd_buf handle some features for the menu like fades and reset related things. The firmware fully unlocks the $2A00-$2BFF block for the menu and then it gets locked (open bus to SNES) except for certain events like NMI/IRQ hook execution. The hook code attempts to read the controller 1 buttons (usually too early with AJR enabled) and performs the WRAM cheat writes along with button checks for resets+other commands.

Author:  Optiroc [ Mon Jan 15, 2018 4:58 am ]
Post subject:  Re: How to debug custom sd2snes fw? (Possible n00b question)

I'm very curious about this project! Did you make any progress, kmeisthax?

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/