219
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										219
									
								
								index.html
									
									
									
									
									
								
							@@ -89,43 +89,37 @@
 | 
			
		||||
				<h2>Fomu: an FPGA in your USB Port</h2>
 | 
			
		||||
				<img src="img/tomu-fomu-case-superwide.jpg">
 | 
			
		||||
				<p>
 | 
			
		||||
					Fomu (with case): an FPGA in your USB port. Crowdfunding now! One week to go. <a href="https://t.xobs.io/fomu">t.xobs.io/fomu</a>
 | 
			
		||||
					Pre-order now on Crowd Supply!  <a href="https://t.xobs.io/fomu">t.xobs.io/fomu</a>
 | 
			
		||||
				</p>
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
			<section data-background-image="css/theme/lca2019-title-bg-transparent.svg">
 | 
			
		||||
				<h1>Fomu: An FPGA in your USB Port</h1>
 | 
			
		||||
				<h4>A whirlwind introduction to Fomu and FPGAs</h4>
 | 
			
		||||
				<h4>A whirlwind introduction to Fomu; a workshop in three levels</h4>
 | 
			
		||||
				<p align="right">
 | 
			
		||||
					<small>Sean Cross - <a href="https://xobs.io/">https://xobs.io/</a> - @xobs</small>
 | 
			
		||||
				</p>
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
			<section>
 | 
			
		||||
				<h3>Outline</h3>
 | 
			
		||||
				<ol>
 | 
			
		||||
					<li>Fomu Firmware Layout</li>
 | 
			
		||||
					<li>
 | 
			
		||||
						<ol>
 | 
			
		||||
							<li>Bootloader</li>
 | 
			
		||||
							<li>Recovery</li>
 | 
			
		||||
							<li>Magic constants</li>
 | 
			
		||||
							<li>Interpreters</li>
 | 
			
		||||
							<li>Updates</li>
 | 
			
		||||
						</ol>
 | 
			
		||||
					</li>
 | 
			
		||||
					<li>Loading firmware onto Fomu</li>
 | 
			
		||||
					<li>Blinkenlights</li>
 | 
			
		||||
				</ol>
 | 
			
		||||
				<h2>Levels of Fomu</h2>
 | 
			
		||||
				<p>
 | 
			
		||||
					Fomu aims to be accessable on three levels:
 | 
			
		||||
					<ol>
 | 
			
		||||
						<li>Python / Interpreted</li>
 | 
			
		||||
						<li>RISC-V</li>
 | 
			
		||||
						<li>Verilog / FPGA</li>
 | 
			
		||||
					</ol>
 | 
			
		||||
				</p>
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
			<section>
 | 
			
		||||
				<h2>Workshop Outline</h2>
 | 
			
		||||
				<ol>
 | 
			
		||||
					<li>What do I need to get started?</li>
 | 
			
		||||
					<li>What is Fomu, and what is an FPGA?</li>
 | 
			
		||||
					<li>What can I do with Fomu?</li>
 | 
			
		||||
					<li>What is an FPGA, and what is Fomu?</li>
 | 
			
		||||
					<li>What makes Fomu special?</li>
 | 
			
		||||
					<li>What can I do with Fomu?</li>
 | 
			
		||||
				</ol>
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
@@ -133,9 +127,13 @@
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What do I need to get started?</h2>
 | 
			
		||||
					<ol>
 | 
			
		||||
						<li>DFU utilities</li>
 | 
			
		||||
						<li>Serial console</li>
 | 
			
		||||
						<li>RISC-V toolchain</li>
 | 
			
		||||
						<li>Synthesis</li>
 | 
			
		||||
						<li>Place-and-Route</li>
 | 
			
		||||
						<li>Packer</li>
 | 
			
		||||
						<li>Python 3</li>
 | 
			
		||||
					</ol>
 | 
			
		||||
				</section>
 | 
			
		||||
			</section>
 | 
			
		||||
@@ -143,34 +141,65 @@
 | 
			
		||||
			<section>
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What is an FPGA?</h2>
 | 
			
		||||
					<p>
 | 
			
		||||
						An FPGA is like a hardware emulator.  It can change itself so that it can take on the characteristics of any other digital logic.
 | 
			
		||||
					</p>
 | 
			
		||||
					<p>
 | 
			
		||||
						FPGAs are measured in resources called LUTs or LCs.
 | 
			
		||||
					</p>
 | 
			
		||||
					<img data-src="img/ice40-lut.png" alt="SB_LUT4">
 | 
			
		||||
					<!--
 | 
			
		||||
						<p>
 | 
			
		||||
							An FPGA is a chip that executes logic.
 | 
			
		||||
						</p>
 | 
			
		||||
						<p>
 | 
			
		||||
							FPGAs are measured in resources called LUTs or LCs.
 | 
			
		||||
						</p>
 | 
			
		||||
					-->
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What is an FPGA?</h2>
 | 
			
		||||
					<pre><code class="verilog" data-trim>
 | 
			
		||||
							module DFF (output reg Q, input C, D, R);
 | 
			
		||||
								always @(posedge C)
 | 
			
		||||
								if (~R) begin
 | 
			
		||||
									Q <= 1'b0;
 | 
			
		||||
								end else begin
 | 
			
		||||
									Q <= D;
 | 
			
		||||
								end
 | 
			
		||||
							endmodule						  
 | 
			
		||||
						</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>About the ICE40UP5K</h2>
 | 
			
		||||
					<ol>
 | 
			
		||||
						<li>5280 4-input LUTs (LC)</li>
 | 
			
		||||
						<li>16 kilobytes BRAM</li>
 | 
			
		||||
						<li class="fragment highlight-blue">128 kilobytes "SPRAM"</li>
 | 
			
		||||
						<li>Current-limited 3-channel LED</li>
 | 
			
		||||
						<li>2x I2C and 2x SPI</li>
 | 
			
		||||
						<li>8 16-bit DSP units</li>
 | 
			
		||||
						<li>Warmboot capability</li>
 | 
			
		||||
					</ol>
 | 
			
		||||
				</section>
 | 
			
		||||
	
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What is Fomu?</h2>
 | 
			
		||||
					<p>
 | 
			
		||||
					<ul>
 | 
			
		||||
						<li>ICE40UP5K in your USB port</li>
 | 
			
		||||
						<li>2MB flash memory</li>
 | 
			
		||||
						<li>Four edge-plated pads</li>
 | 
			
		||||
						<li>ESD protection</li>
 | 
			
		||||
						<li>USB implemented in HDL</li>
 | 
			
		||||
					</ul>
 | 
			
		||||
					<!-- <p>
 | 
			
		||||
						Fomu is an FPGA that fits in your USB port.  It has foru buttons, 2 MB of SPI flash, an RGB LED, and an ICE40UP5K with 5280 LCs.  It also has 128 kB of dedicated RAM, not counting the block RAM.
 | 
			
		||||
 | 
			
		||||
						Unlike many other PCBs, Fomu does not have a separate USB controller chip.  This means that any projects that want to use the USB port must include a USB softcore.
 | 
			
		||||
					</p>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Fomu Block Design Diagram</h2>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>ICE40 Features</h2>
 | 
			
		||||
					</p> -->
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What is this PCB?</h2>
 | 
			
		||||
					<p>
 | 
			
		||||
					<img data-src="img/tomu-fpga-evt-1-small.jpg" alt="Fomu EVT1">
 | 
			
		||||
					<h3>Fomu EVT1</h3>
 | 
			
		||||
					<!-- <p>
 | 
			
		||||
						This is Fomu EVT1.  This is the original stretch prototype of Fomu.  The schematics are the same, but much has changed:
 | 
			
		||||
 | 
			
		||||
						* Name changed from Tomu-FPGA to Fomu
 | 
			
		||||
@@ -189,19 +218,35 @@
 | 
			
		||||
						* Populate Raspberry Pi header
 | 
			
		||||
						* Add PMOD pins to touchpads
 | 
			
		||||
						* Swap PMODa pins for I3C
 | 
			
		||||
					</p>
 | 
			
		||||
					</p> -->
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>What modifications does it have?</h2>
 | 
			
		||||
					<ul>
 | 
			
		||||
						<li>Shorting out two zero-ohm resistors</li>
 | 
			
		||||
						<li>Shorting out two zero-ohm resistors (R7, PU)</li>
 | 
			
		||||
						<li>Programming SPI flash</li>
 | 
			
		||||
						<li>Bending SPI flash pins inward</li>
 | 
			
		||||
						<li>Mounting crystal on its side</li>
 | 
			
		||||
						<li>Bending SPI flash pins inward (U4)</li>
 | 
			
		||||
						<li>Mounting crystal on its side (U7)</li>
 | 
			
		||||
						<li>Attaching power to crystal</li>
 | 
			
		||||
					</ul>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Fomu Block Design Diagram</h2>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Fomu SPI Flash Layout</h2>
 | 
			
		||||
					<img data-src="img/fomu-memory-layout.png" alt="Fomu memory layout">
 | 
			
		||||
					<!-- <ol>
 | 
			
		||||
						<li>Bootloader</li>
 | 
			
		||||
						<li>Recovery</li>
 | 
			
		||||
						<li>Magic constants</li>
 | 
			
		||||
						<li>Interpreters</li>
 | 
			
		||||
						<li>Updates</li>
 | 
			
		||||
					</ol> -->
 | 
			
		||||
				</section>		
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
			<section>
 | 
			
		||||
@@ -214,70 +259,17 @@
 | 
			
		||||
				</section>
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Updating Fomu</h2>
 | 
			
		||||
					<code>
 | 
			
		||||
						sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢                                                                 [10:45]
 | 
			
		||||
❯ dfu-util -l
 | 
			
		||||
dfu-util 0.9
 | 
			
		||||
 | 
			
		||||
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
 | 
			
		||||
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
 | 
			
		||||
This program is Free Software and has ABSOLUTELY NO WARRANTY
 | 
			
		||||
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
 | 
			
		||||
 | 
			
		||||
Found DFU: [1209:5bf0] ver=0101, devnum=16, cfg=1, intf=0, path="1-1.1.2", alt=0, name="Fomu DFU Bootloader v1.7.2", serial="UNKNOWN"
 | 
			
		||||
sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢                                                                 [10:45]
 | 
			
		||||
❯ dfu-util -D .\pvt-installable.dfu
 | 
			
		||||
dfu-util 0.9
 | 
			
		||||
 | 
			
		||||
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
 | 
			
		||||
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
 | 
			
		||||
This program is Free Software and has ABSOLUTELY NO WARRANTY
 | 
			
		||||
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
 | 
			
		||||
 | 
			
		||||
Match vendor ID from file: 1209
 | 
			
		||||
Match product ID from file: 5bf0
 | 
			
		||||
Opening DFU capable USB device...
 | 
			
		||||
ID 1209:5bf0
 | 
			
		||||
Run-time device DFU version 0101
 | 
			
		||||
Claiming USB DFU Interface...
 | 
			
		||||
Setting Alternate Setting #0 ...
 | 
			
		||||
Determining device status: state = dfuIDLE, status = 0
 | 
			
		||||
dfuIDLE, continuing
 | 
			
		||||
DFU mode device DFU version 0101
 | 
			
		||||
Device returned transfer size 1024
 | 
			
		||||
Copying data from PC to DFU device
 | 
			
		||||
Download        [=========                ]  36%        38912 bytes
 | 
			
		||||
					<pre><code>$ dfu-util -l
 | 
			
		||||
Found DFU: [1209:5bf0] name="Fomu DFU Bootloader v1.7.2"
 | 
			
		||||
$ dfu-util -D evt-installable.dfu
 | 
			
		||||
Download        [=========                ]  36%   38912 bytes
 | 
			
		||||
Download done.
 | 
			
		||||
state(7) = dfuMANIFEST, status(0) = No error condition is present
 | 
			
		||||
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
 | 
			
		||||
Done!
 | 
			
		||||
sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢                                                                 [10:45]
 | 
			
		||||
❯ dfu-util -l
 | 
			
		||||
dfu-util 0.9
 | 
			
		||||
 | 
			
		||||
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
 | 
			
		||||
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
 | 
			
		||||
This program is Free Software and has ABSOLUTELY NO WARRANTY
 | 
			
		||||
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
 | 
			
		||||
 | 
			
		||||
Found DFU: [1209:5bf0] ver=0101, devnum=14, cfg=1, intf=0, path="1-1.1.2", alt=0, name="Fomu DFU Bootloader v1.8.1", serial="UNKNOWN"
 | 
			
		||||
sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢                                                                 [10:47]
 | 
			
		||||
❯
 | 
			
		||||
					</code>
 | 
			
		||||
$ dfu-util -l
 | 
			
		||||
Found DFU: [1209:5bf0] name="Fomu DFU Bootloader v1.8.1"
 | 
			
		||||
$</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
			</section>
 | 
			
		||||
 | 
			
		||||
			<section>
 | 
			
		||||
				<h2>Levels of Fomu</h2>
 | 
			
		||||
				<p>
 | 
			
		||||
					Fomu aims to be accessable on three levels:
 | 
			
		||||
					<ol>
 | 
			
		||||
						<li>Python / Interpreted</li>
 | 
			
		||||
						<li>RISC-V</li>
 | 
			
		||||
						<li>Verilog / FPGA</li>
 | 
			
		||||
					</ol>
 | 
			
		||||
				</p>
 | 
			
		||||
			</section>
 | 
			
		||||
			<section>
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Python / Interpreted</h2>
 | 
			
		||||
@@ -289,25 +281,46 @@ sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢ 
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Loading Programs onto Fomu</h2>
 | 
			
		||||
					<code>dfu-util -l</code>
 | 
			
		||||
					<code>dfu-util -D update.bin</code>
 | 
			
		||||
					<pre><code>
 | 
			
		||||
$ dfu-util -l
 | 
			
		||||
Found DFU: [1209:5bf0] name="Fomu DFU Bootloader v1.8.1"
 | 
			
		||||
$ dfu-util -e                  # Boot current program
 | 
			
		||||
$ dfu-util -D new-image.dfu    # Load new program</code></pre>
 | 
			
		||||
					<h3 class="fragment">u<code>5b f0</code>mu</h3>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Loading MicroPython</h2>
 | 
			
		||||
					<code>dfu-util -D micropython.dfu</code>
 | 
			
		||||
					<pre><code>$ dfu-util -D micropython-fomu.dfu</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Connecting via serial</h2>
 | 
			
		||||
					<pre class="fragment"><code>screen /dev/cu.usbserial*</code></pre>
 | 
			
		||||
					<pre class="fragment"><code>screen /dev/ttyACM*</code></pre>
 | 
			
		||||
					<pre class="fragment"><code>Teraterm</code></pre>
 | 
			
		||||
					<pre class="fragment"><code>MicroPython v1.10-296-g0a5a77a on 2019-06-18; fomu with vexriscv
 | 
			
		||||
>>></code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>Interacting with Fomu</h2>
 | 
			
		||||
					<pre><code class="python" data-trim>
 | 
			
		||||
							>>> import fomu
 | 
			
		||||
							>>> rgb = fomu.rgb()
 | 
			
		||||
							>>> rgb.mode("error")
 | 
			
		||||
							>>> 
 | 
			
		||||
					</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<h2>RGB LEDD reference</h2>
 | 
			
		||||
					<img data-src="img/ice40-ledd.png" alt="ICE40 LEDD registers">
 | 
			
		||||
					<pre class="fragment"><code class="python" data-trim>>>> rgb.write_raw(0b0001, 255)
 | 
			
		||||
>>> rgb.write_raw(0b1010, 14)
 | 
			
		||||
>>> rgb.write_raw(0b1011, 1)
 | 
			
		||||
>>> 
 | 
			
		||||
</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user