Modify MiSTer Main to bring broken DE10 back to life
Hi everyone! I need some assistance from MiSTer devs to modify and compile Main code in order to bring back to life a dead DE10 Nano.
TL;DR:
- DE10 Nano has shorted GPIO17 (Reset), confirmed via multimeter
- Board behaves as if the reset button is constantly pressed, preventing the load of MiSTer
- Need help to modify MiSTer Main to prevent reading the reset button (if possible)
Almost two years ago, my “first” MiSTer broke by means of an electrical static discharge when pressing the reset button on the IO Board without any case: Static electricity discharge killed DE10. From that day forward, I have seen many people in the forum reporting killing the DE10 due to static.
In particular, later this year GamingDoyle had a very similar issue and found an easy fix. In his setup, the DE10 Nano had a short between GPIO Pin 13 (OSD) and ground, meaning that the button was pressed all the time. That caused the menu to be displayed all the time (Disable Bluetooth). Based on his conversation with Terasic Support, I ran a diode test on all 36 GPIO1 pins (D0-D35) that are not power/ground (11, 12, 29, 30 in the 2x20 header). Here is what they asked him to do:
You can test the GPIO I/O pins, power off the board, set the switch of multimeter to the diode label position, red probe connect to GND, black probe connect to 36 I/O pins one by one. Pay attention to the power pins, don't touch them, then tell us the result for analyzing.
I found that in my DE10 Nano, the GPIO1 Pin 17 (RESET) is shorted, while all the other pins are working correctly. This was always my suspicion and it is good to finally being able to confirm it. I have the theory that because the reset button is always pressed, the MiSTer code is not able to start correctly, therefore rendering the board useless. And that also explains why other payloads, such as the linux distribution provided in the DE10 sd card and the MiSTer fusion image work well (i.e., these are ignoring GPIO17).
Based on the findings above, my goal is simple. I want to modify the code of MiSTer Main to avoid reading that GPIO pin entirely, and therefore bypassing the issue and bringing the DE10 back to life. However, after reading the code I am very confused. Looks like the reset behavior is much more complicated than that of the OSD/User buttons. I have been playing with the code, commenting out functions in fpga_io.cpp
and recompiling the binary without success. A few things that I have tried:
- Commenting out fpga_get_buttons and returning 0 (GamingDoyle’s solution, only applies to OSD and MENU) fpga_io.cpp#L567
- Commenting out reboot fpga_io.cpp#L581
- Commenting out fpga_core_reset fpga_io.cpp#L631
So far nothing has worked. I have the suspicion that there is some check in a loop that is preventing MiSTer to start because the state of the board is not correct. Maybe someone can confirm and assist me to bypass that check in my custom fork.
Summarizing, my questions are the following:
- Where is the code that references GPIO17 and reads it. If there are more than one place, which one is critical for booting up?
- Why are GPIO13/15 referenced like this? That could help me to understand the code better [gpi >> 29) & 3]
- Is there some kind of check that reads GPIO17 to evaluate the status of the board?
Thanks in advance, any help would be appreciated, specially now that so many new cores are being developed/released. It is a crime to have a DE10 board stored in a box and not being able to use it.