orangecrab-fpga / orangecrab-hardware

ECP5 breakout board in a feather physical format
Other
485 stars 57 forks source link

Missing pullup on PROGRAMN #32

Open gregdavill opened 3 years ago

gregdavill commented 3 years ago

Summary

Hardware revision r0.2 didn't have an external resistor on the PROGRAMN pin. This pin is driven by the FPGA to reset the device into the bootloader.

Observed Behavior

There has been 2-3 reports of users experiencing the the bootloader not loading their programs. Instead the device just sits with the LED on WHITE. Entering the bootloader can be done at anytime by pressing btn0. This behaviour indicates that the device in cycling in/out of the bootloader, since the bootloader only checks the button state once on power-up.

This seems to be related to this pin on some boards the internal resistance isn't strong enough to counteract the weak-pulldown of an I/O pin it's connected to.

Proposed Fix

New hardware

Existing r0.2 hardware

diff --git a/nmigen/blink.py b/nmigen/blink.py
index a966594..cf1803c 100644
--- a/nmigen/blink.py
+++ b/nmigen/blink.py
@@ -23,6 +23,10 @@ class Blink(Elaboratable):
             blue_led.o.eq(self.count[25]),
         ]

+        # Ensure FPGA PROGRAMN pin is released.
+        program = platform.request('program')
+        m.d.sync += program.o.eq(0)
+
         return m

Note: in nMigen the program pin defined in the platform file is marked as active low, nMigen internally negates the values we assign to it.

tommythorn commented 3 years ago

Might make a good addition to the r0.2 Errata (which I'd suggest including in the README.md lest it gets missed)