# running orangecrab-examples before flashing microwatt
-If the OrangeCrab is running in DFU mode, lsusb will show
+If the OrangeCrab is running in DFU mode, lsusb will show:
1209:5af0 Generic OrangeCrab r0.2 DFU Bootloader v3.1-6-g62e92e2
+
+OrangeCrab has two DFU devices:
+
+ Found DFU: [1209:5af0] ver=0101, devnum=22, cfg=1, intf=0, path="1-4.2", alt=1, name="0x00100000 RISC-V Firmware", serial="UNKNOWN"
+ Found DFU: [1209:5af0] ver=0101, devnum=22, cfg=1, intf=0, path="1-4.2", alt=0, name="0x00080000 Bitstream", serial="UNKNOWN"
+
+Then clone and patch orangecrab-examples:
+
+ git clone https://github.com/orangecrab-fpga/orangecrab-examples
+ patch -p1 < orangecrab-examples.diff
+
+To build and flash the example:
+
+ pushd orangecrab-examples/nmigen
+ python3 blink.py
+ popd
+ sudo dfu-util -D orangecrab-examples/nmigen/build/top.bit -a 0
--- /dev/null
+diff --git a/nmigen/blink.py b/nmigen/blink.py
+index a966594..6e78cc6 100644
+--- a/nmigen/blink.py
++++ b/nmigen/blink.py
+@@ -16,16 +16,32 @@ class Blink(Elaboratable):
+ red_led = rgb.r
+ green_led = rgb.g
+ blue_led = rgb.b
+-
+- m.d.comb += [
+- red_led.o.eq(self.count[27]),
+- green_led.o.eq(self.count[26]),
+- blue_led.o.eq(self.count[25]),
+- ]
+-
++ #platform.request('0')
++ #platform.request('1')
++ color = "BLUE"
++
++ ## 27 26 25
++ if color=="GREEN":
++ m.d.comb += [
++ red_led.o.eq(0),
++ green_led.o.eq(self.count[26]),
++ blue_led.o.eq(0),
++ ]
++ elif color=="RED":
++ m.d.comb += [
++ red_led.o.eq(self.count[26]),
++ green_led.o.eq(0),
++ blue_led.o.eq(0),
++ ]
++ elif color=="BLUE":
++ m.d.comb += [
++ red_led.o.eq(0),
++ green_led.o.eq(0),
++ blue_led.o.eq(self.count[26]),
++ ]
+ return m
+
+
+ if __name__ == "__main__":
+- platform = OrangeCrabR0_2Platform()
+- platform.build(Blink(), do_program=True)
++ platform = OrangeCrabR0_2_85k_Platform()
++ platform.build(Blink(), do_program=False)