Skip to content

Commit 6d120d3

Browse files
authored
Merge branch 'main' into sprint-2
2 parents 30c373a + 193a06d commit 6d120d3

File tree

3 files changed

+160
-7
lines changed

3 files changed

+160
-7
lines changed

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
FPGA and software crossover to bring your microphone clarity and fidelity
44

5-
**[Time Logs]**
6-
Time logging notes beyond git commits are available in **resources/**.
7-
8-
**[Hardware]**
9-
10-
VHDL files included in 'vhdl' folder. Schematic files included in 'schematics' folder.
11-
125
**[Software]**
136

147
Dependencies:
@@ -24,3 +17,34 @@ Steps to run:
2417
Current development is done on Windows and the main target platform is Windows. This application is built using ElectronJS and ReactJS
2518

2619
Note: When installing packages, a warning will appear about npm package vulnerabilities. This is not a concern and is addressed here: https://github.com/facebook/create-react-app/issues/11174
20+
21+
**[Hardware]**
22+
23+
VHDL files included in 'vhdl' folder. Schematic files included in 'schematics' folder.
24+
25+
Synthesizing steps:
26+
27+
The HDL is synthesized by the Vivado 2021.1 build system. It has not been tested on other versions of Vivado.
28+
1. Download the Vivado project zip file from the Releases tab.
29+
2. Unzip the archive and open the project in Vivado
30+
3. Double click on "Generate Bitstream" to generate the bitstream for the Arty A7-35 (xc7a35ticsg324-1L) FPGA, which is preconfigured. Other devices may be selected, however neither performance nor compatibility are guaranteed.
31+
32+
The default pinout, which can also be found in the constraint file, is:
33+
clk - E3
34+
rst - C2
35+
sampleIn[0:7] - D4, D3, F4, F3, E2, D2, H2, G2
36+
sampleOut[0:7] - G13, B11, A11, D12, D13, B18, A18, K16
37+
38+
For status of the filter on the Arty A7 devboard, it outputs to a status LED:
39+
filterActive - H5
40+
41+
The switch on the devboard enables the filter
42+
filterEn - A8
43+
44+
45+
The pins for the TLC0820:
46+
extCS - E15
47+
extRD - E16
48+
extReady - D15
49+
50+
The MX7224 is held in transparent mode

public/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function createWindow() {
6161
}
6262
);
6363

64+
6465
ipcMain.on("process-audio", (event, rawRecordedData, sampleRate) => {
6566
//Pitch method is deprecated
6667
try {

vhdl/UART_RX_CTRL.vhd

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
-- ClariFi
2+
-- Part: XC7A35TICSG324-1L
3+
-- UART_RX_CTRL - Utilizes the Arty A7's USB-UART Bridge (Serial Port)
4+
-- Serialization information:
5+
-- TXD -> Pin A9
6+
-- RXD -> Pin D10
7+
-- 115200 Baud Rate
8+
-- 8 Data Bits, LSB First
9+
-- 1 Stop Bit
10+
-- No parity
11+
-- Data needs to be sampled at a rate of at least 115200*8 = 921.600 KHz
12+
-- A 100 MHz clock is expected. We sample in the middle of a bit data.
13+
14+
library ieee;
15+
use ieee.std_logic_1164.ALL;
16+
use ieee.numeric_std.all;
17+
18+
entity UART_RX_CTRL is
19+
generic (
20+
CLKS_PER_BIT : integer := 868 -- 868 = round(100MHz / 115200)
21+
);
22+
port (
23+
CLK : in std_logic;
24+
RST : in std_logic;
25+
UART_RX : in std_logic;
26+
RX_DONE : out std_logic;
27+
DATA : out std_logic_vector(7 downto 0)
28+
);
29+
end UART_RX_CTRL;
30+
31+
architecture BHV of UART_RX_CTRL is
32+
33+
type state_type is (S_START, S_START_BIT, S_DATA_BITS, S_STOP_BIT, S_DONE);
34+
signal state : state_type := S_START;
35+
36+
signal r_UART_RX : std_logic := '0';
37+
signal r_r_UART_RX : std_logic := '0';
38+
39+
signal r_Bit_Counter : integer range 0 to CLKS_PER_BIT-1 := 0;
40+
signal r_Bit_Index : integer range 0 to 7 := 0; -- 8 Bits Total
41+
signal r_RX_Byte : std_logic_vector(7 downto 0) := (others => '0');
42+
signal r_RX_DONE : std_logic := '0';
43+
44+
begin
45+
process (CLK)
46+
begin
47+
if rising_edge(CLK) then
48+
-- Dual-flop synchronizer to stabilize incoming signal (data)
49+
r_UART_RX <= UART_RX;
50+
r_r_UART_RX <= r_UART_RX;
51+
52+
case state is
53+
54+
when S_START =>
55+
r_RX_DONE <= '0';
56+
r_Bit_Counter <= 0;
57+
r_Bit_Index <= 0;
58+
59+
if (r_r_UART_RX = '0') then -- falling_edge(r_r_UART_RX) then -- Start bit transitioned from '1' to '0'
60+
state <= S_START_BIT;
61+
end if;
62+
state <= S_START;
63+
64+
-- Sample half bit later to make sure it's still low
65+
when S_START_BIT =>
66+
if r_Bit_Counter = (CLKS_PER_BIT-1)/2 then
67+
if r_r_UART_RX = '0' then
68+
r_Bit_Counter <= 0; -- Reset the counter
69+
state <= S_DATA_BITS; -- We are receiving data
70+
else
71+
state <= S_START; -- Start bit was not held low long enough
72+
end if;
73+
else
74+
r_Bit_Counter <= r_Bit_Counter + 1;
75+
state <= S_START_BIT;
76+
end if;
77+
78+
79+
-- Sample data after CLKS_PER_BIT-1 clock cycles
80+
when S_DATA_BITS =>
81+
if r_Bit_Counter < CLKS_PER_BIT-1 then
82+
r_Bit_Counter <= r_Bit_Counter + 1;
83+
state <= S_DATA_BITS;
84+
else
85+
r_Bit_Counter <= 0;
86+
r_RX_Byte(r_Bit_Index) <= r_r_UART_RX;
87+
88+
-- Loop back until all 8 bits have been added to r_RX_Byte
89+
if r_Bit_Index < 7 then
90+
r_Bit_Index <= r_Bit_Index + 1;
91+
state <= S_DATA_BITS;
92+
else
93+
r_Bit_Index <= 0;
94+
state <= S_STOP_BIT;
95+
end if;
96+
end if;
97+
98+
99+
-- Receive last bit, 1 stop bit.
100+
when S_STOP_BIT =>
101+
-- Check stop bit after CLKS_PER_BIT-1 clock cycles
102+
if r_Bit_Counter < CLKS_PER_BIT-1 then
103+
r_Bit_Counter <= r_Bit_Counter + 1;
104+
state <= S_STOP_BIT;
105+
else
106+
r_RX_DONE <= '1';
107+
r_Bit_Counter <= 0;
108+
state <= S_DONE;
109+
end if;
110+
111+
112+
-- Wait 1 cycle before going back to S_START
113+
when S_DONE =>
114+
state <= S_START;
115+
r_RX_DONE <= '0';
116+
117+
-- Should never be reached
118+
when others =>
119+
state <= S_START;
120+
121+
end case;
122+
end if;
123+
end process;
124+
125+
RX_DONE <= r_RX_DONE;
126+
DATA <= r_RX_Byte;
127+
128+
end BHV;

0 commit comments

Comments
 (0)