update orangecrab-examples section
authorTobias Platen <tplaten@posteo.de>
Thu, 10 Mar 2022 18:52:26 +0000 (19:52 +0100)
committerTobias Platen <tplaten@posteo.de>
Thu, 10 Mar 2022 18:52:26 +0000 (19:52 +0100)
HDL_workflow/microwatt.mdwn
HDL_workflow/orangecrab-examples.diff [new file with mode: 0644]

index d87b14781e7bb3bb34b4db13f606a4d9d316d781..1acedf73d80f969be996cfa359ca836916635e36 100644 (file)
@@ -142,6 +142,23 @@ separate USB-serial adapter. see the following for further details:
 
 # 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
diff --git a/HDL_workflow/orangecrab-examples.diff b/HDL_workflow/orangecrab-examples.diff
new file mode 100644 (file)
index 0000000..f3cdf2c
--- /dev/null
@@ -0,0 +1,46 @@
+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)