Skip to content

Commit

Permalink
uploaded fpga camera and fpga accelerometer project
Browse files Browse the repository at this point in the history
  • Loading branch information
tritainguyen98 committed Mar 12, 2020
1 parent b8b7fb9 commit 5090573
Show file tree
Hide file tree
Showing 22 changed files with 11,720 additions and 0 deletions.
5 changes: 5 additions & 0 deletions IceStick_Accelerometer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# IceStick-Accelerometer

Loads SPI controller onto IceStick and reads accelerometer data. Leds will turn on/off according to orientation.

Using open source toolchain, (Yosys, arachne-pnr, and IceStorm) load verilog files onto Icestick, and connect accelerometer. The leds on the IceStick should turn on/off to indicate the direction of tilt with respect to gravity.
28 changes: 28 additions & 0 deletions IceStick_Accelerometer/src/PmodACL_Demo_pcf_sbt.pcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ##############################################################################

# iCEcube PCF

# Version: 2012.09SP1.22498

# File Generated: Jun 13 2013 14:14:52

# Family & Device: iCE40HX1K

# Package: TQ144

# ##############################################################################

###IOSet List 12
set_io clk_in 21
set_io LED 95
set_io LED_MINUS[0] 99
set_io LED_PLUS[1] 96
set_io SCLK 81 -pullup yes
set_io SDI 80 -pullup yes
set_io SDO 79 -pullup yes
set_io test2 45
set_io LED_MINUS[1] 98
set_io LED_PLUS[0] 97
set_io SS 78 -pullup yes
set_io test1 47

58 changes: 58 additions & 0 deletions IceStick_Accelerometer/src/clkdiv_5hz.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
`timescale 1ns / 1ps
// Created By: Tritai Nguyen
// Create Date: 03/07/2020
// Module Name: ClkDiv_5Hz
// Project Name: PmodACL_Demo

// ====================================================================================
// Define Module
// ====================================================================================
module ClkDiv_5Hz(
CLK,
RST,
CLKOUT
);

// ====================================================================================
// Port Declarations
// ====================================================================================
input CLK; // 100MHz onboard clock
input RST; // Reset
output CLKOUT; // New clock output


// ====================================================================================
// Parameters, Registers, and Wires
// ====================================================================================
reg CLKOUT;

// Current count value
reg [23:0] clkCount = 24'h000000;
// Value to toggle output clock at
parameter [23:0] cntEndVal = 24'h989680;

// ===================================================================================
// Implementation
// ===================================================================================

//------------------------------------------------
// 5Hz Clock Divider Generates Send/Receive signal
//------------------------------------------------
always @(posedge CLK or posedge RST)

// Reset clock
if (RST == 1'b1) begin
CLKOUT <= 1'b0;
clkCount <= 24'h000000;
end
else begin
if (clkCount == cntEndVal) begin
CLKOUT <= (~CLKOUT);
clkCount <= 24'h000000;
end
else begin
clkCount <= clkCount + 1'b1;
end
end

endmodule
38 changes: 38 additions & 0 deletions IceStick_Accelerometer/src/ice_pll.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module ice_pll(REFERENCECLK,
PLLOUTCORE,
PLLOUTGLOBAL,
RESET);

input REFERENCECLK;
input RESET; /* To initialize the simulation properly, the RESET signal (Active Low) must be asserted at the beginning of the simulation */
output PLLOUTCORE;
output PLLOUTGLOBAL;

SB_PLL40_CORE ice_pll_inst(.REFERENCECLK(REFERENCECLK),
.PLLOUTCORE(PLLOUTCORE),
.PLLOUTGLOBAL(PLLOUTGLOBAL),
.EXTFEEDBACK(),
.DYNAMICDELAY(),
.RESETB(RESET),
.BYPASS(1'b0),
.LATCHINPUTVALUE(),
.LOCK(),
.SDI(),
.SDO(),
.SCLK());

//\\ Fin=12, Fout=88;
defparam ice_pll_inst.DIVR = 4'b0000;
defparam ice_pll_inst.DIVF = 7'b0111010;
defparam ice_pll_inst.DIVQ = 3'b011;
defparam ice_pll_inst.FILTER_RANGE = 3'b001;
defparam ice_pll_inst.FEEDBACK_PATH = "SIMPLE";
defparam ice_pll_inst.DELAY_ADJUSTMENT_MODE_FEEDBACK = "FIXED";
defparam ice_pll_inst.FDA_FEEDBACK = 4'b0000;
defparam ice_pll_inst.DELAY_ADJUSTMENT_MODE_RELATIVE = "FIXED";
defparam ice_pll_inst.FDA_RELATIVE = 4'b0000;
defparam ice_pll_inst.SHIFTREG_DIV_MODE = 2'b00;
defparam ice_pll_inst.PLLOUT_SELECT = "GENCLK";
defparam ice_pll_inst.ENABLE_ICEGATE = 1'b0;

endmodule
4 changes: 4 additions & 0 deletions IceStick_Accelerometer/src/ice_pll_inst.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ice_pll ice_pll_inst(.REFERENCECLK(),
.PLLOUTCORE(),
.PLLOUTGLOBAL(),
.RESET());
Binary file added IceStick_Accelerometer/src/pmodacl.bin
Binary file not shown.
Loading

0 comments on commit 5090573

Please sign in to comment.