Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions caravel.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ def power_down(self):
resource_name = usb_devices[0]
inst = rm.open_resource(resource_name)
inst.query_delay = 0.1
inst.write("OUTP CH1, OFF")
inst.write("OUTP CH1,OFF")
time.sleep(0.1)
inst.write("OUTP CH2, OFF")
inst.write("OUTP CH2,OFF")
time.sleep(0.1)
rm.close()
else:
Expand All @@ -296,11 +296,11 @@ def power_up(self):
inst.query_delay = 0.1
inst.write(f"CH1:VOLT {self.l_voltage}")
time.sleep(0.1)
inst.write("OUTP CH1, ON")
inst.write("OUTP CH1,ON")
time.sleep(0.1)
inst.write(f"CH2:VOLT {self.h_voltage}")
time.sleep(0.1)
inst.write("OUTP CH2, ON")
inst.write("OUTP CH2,ON")
time.sleep(0.8)
l_volt = float(inst.query('MEAsure:VOLTage? CH1'))
h_volt = float(inst.query('MEAsure:VOLTage? CH2'))
Expand All @@ -309,7 +309,7 @@ def power_up(self):
error_tolerance = 0.1

if not math.isclose(l_volt, l_volt_expected, abs_tol=error_tolerance) or not math.isclose(h_volt, h_volt_expected, abs_tol=error_tolerance):
Console.print(f"[red]Error: {resource_name} not within 0.1V of expected voltages")
self.console.print(f"[red]Error: {resource_name} not within 0.1V of expected voltages")
self.turn_off_devices()
exit()
rm.close()
Expand All @@ -335,22 +335,22 @@ def power_up_1v8(self):
resource_name = usb_devices[0]
inst = rm.open_resource(resource_name)
inst.query_delay = 0.1
inst.write("CH1:VOLT 1.8")
inst.write("CH1:VOLTage 1.8")
time.sleep(0.1)
inst.write("OUTP CH1, ON")
inst.write("OUTPut CH1,ON")
time.sleep(0.1)
inst.write("CH2:VOLT 3.3")
inst.write("CH2:VOLTage 3.3")
time.sleep(0.1)
inst.write("OUTP CH2, ON")
time.sleep(0.8)
inst.write("OUTPut CH2,ON")
time.sleep(1.5)
l_volt = float(inst.query('MEAsure:VOLTage? CH1'))
h_volt = float(inst.query('MEAsure:VOLTage? CH2'))
l_volt_expected = 1.8
h_volt_expected = 3.3
error_tolerance = 0.1

if not math.isclose(l_volt, l_volt_expected, abs_tol=error_tolerance) or not math.isclose(h_volt, h_volt_expected, abs_tol=error_tolerance):
Console.print(f"[red]Error: {resource_name} not within 0.1V of expected voltages")
self.console.print(f"[red]Error: {resource_name} not within 0.1V of expected voltages")
self.turn_off_devices()
exit()
rm.close()
Expand All @@ -374,9 +374,9 @@ def turn_off_devices(self):
resource_name = usb_devices[0]
inst = rm.open_resource(resource_name)
inst.query_delay = 0.1
inst.write("OUTP CH1, OFF")
inst.write("OUTP CH1,OFF")
time.sleep(0.1)
inst.write("OUTP CH2, OFF")
inst.write("OUTP CH2,OFF")
time.sleep(0.1)
rm.close()
else:
Expand All @@ -397,9 +397,9 @@ def close_devices(self):
resource_name = usb_devices[0]
inst = rm.open_resource(resource_name)
inst.query_delay = 0.1
inst.write("OUTP CH1, OFF")
inst.write("OUTP CH1,OFF")
time.sleep(0.1)
inst.write("OUTP CH2, OFF")
inst.write("OUTP CH2,OFF")
time.sleep(0.1)
rm.close()
else:
Expand Down Expand Up @@ -572,13 +572,14 @@ def set_value(self, value):


class UART:
def __init__(self, device_data):
def __init__(self, device_data, baud_rate):
self.device_data = device_data
self.rx = 8
# self.tx = 5
self.tx = 7
self.baud_rate = baud_rate

def open(self, baud_rate=9600, parity=None, data_bits=8, stop_bits=1):
def open(self, parity=None, data_bits=8, stop_bits=1):
"""
initializes UART communication

Expand All @@ -591,7 +592,7 @@ def open(self, baud_rate=9600, parity=None, data_bits=8, stop_bits=1):
- stop_bits (default is 1)
"""
# set baud rate
dwf.FDwfDigitalUartRateSet(self.device_data.handle, ctypes.c_double(baud_rate))
dwf.FDwfDigitalUartRateSet(self.device_data.handle, ctypes.c_double(self.baud_rate))

# set communication channels
dwf.FDwfDigitalUartTxSet(self.device_data.handle, ctypes.c_int(self.tx))
Expand Down
4 changes: 3 additions & 1 deletion manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from devices import *

l_voltage = [1.62, 1.8, 1.98]
l_voltage = [1.6, 1.8, 1.95]
h_voltage = [3.0, 3.3, 3.6]
# l_voltage = [1.8]
# h_voltage = [3.3]
# voltage = [1.62, 1.70, 1.75, 1.80, 1.85, 1.90, 1.98]

TestDict = [
Expand Down
38 changes: 28 additions & 10 deletions si_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import signal
import sys
from rich.table import Table
from WF_SDK import logic, wavegen, static, scope
from WF_SDK import logic, wavegen, static, scope, pattern
import matplotlib.pyplot as plt
import numpy as np

Expand Down Expand Up @@ -68,14 +68,14 @@ def init_ad_ios(device1_data, device2_data, device3_data):
}

device3_dio_map = {
14: Dio(2, device3_data),
15: Dio(3, device3_data),
16: Dio(4, device3_data),
17: Dio(5, device3_data),
18: Dio(6, device3_data),
19: Dio(7, device3_data),
20: Dio(8, device3_data),
21: Dio(9, device3_data),
14: Dio(0, device3_data),
15: Dio(1, device3_data),
16: Dio(2, device3_data),
17: Dio(3, device3_data),
18: Dio(4, device3_data),
19: Dio(5, device3_data),
20: Dio(6, device3_data),
21: Dio(7, device3_data),
}

return device1_dio_map, device2_dio_map, device3_dio_map
Expand Down Expand Up @@ -2101,6 +2101,7 @@ def exec_test(
start_time,
hex_file,
flash_flag=True,
freq_40MHz=False,
uart=False,
uart_data=None,
mgmt_gpio=False,
Expand Down Expand Up @@ -2137,6 +2138,8 @@ def exec_test(
Returns:
None
"""
if freq_40MHz:
pattern.generate(test.deviced.ad_device, 15 , function=pattern.function.pulse, frequency=40000000, duty_cycle=50)
results = False
results = flash_test(
test,
Expand Down Expand Up @@ -2308,6 +2311,12 @@ def get_last_test_name(test):
default=False,
help="Flag to skip JTAG IOs testing in caravel-dft chips",
)
parser.add_argument(
"--freq_40MHz",
action="store_true",
default=False,
help="Flag when running with clock frequency 40 MHz (Note: if this flasg is not set, it is assumed that the clock frequency is 10 MHz)",
)
args = parser.parse_args()
# Import specified manifest file
if args.manifest is None:
Expand Down Expand Up @@ -2342,7 +2351,11 @@ def get_last_test_name(test):
device3 = Device(device3_data, 2, device3_dio_map)

test = Test(device1, device2, device3)
uart_data = UART(device1_data)
if args.freq_40MHz:
uart_data = UART(device1_data, 48017)
else:
uart_data = UART(device1_data, 9600)

spi = SPI(device1_data)

csv_header = [
Expand Down Expand Up @@ -2421,6 +2434,7 @@ def get_last_test_name(test):
flash_only=args.flash_only,
verbose=args.verbose,
analog=manifest_module.analog,
freq_40MHz=args.freq_40MHz,
)
elif t.get("mgmt_gpio"):
exec_test(
Expand All @@ -2432,6 +2446,7 @@ def get_last_test_name(test):
flash_only=args.flash_only,
verbose=args.verbose,
analog=manifest_module.analog,
freq_40MHz=args.freq_40MHz,
)
elif t.get("io"):
exec_test(
Expand All @@ -2445,6 +2460,7 @@ def get_last_test_name(test):
verbose=args.verbose,
analog=manifest_module.analog,
dft=args.dft,
freq_40MHz=args.freq_40MHz,
)
elif t.get("plud"):
exec_test(
Expand All @@ -2458,6 +2474,7 @@ def get_last_test_name(test):
verbose=args.verbose,
analog=manifest_module.analog,
dft=args.dft,
freq_40MHz=args.freq_40MHz,
)
elif t.get("and_flag"):
exec_test(
Expand Down Expand Up @@ -2553,6 +2570,7 @@ def get_last_test_name(test):
uart_data=uart_data,
verbose=args.verbose,
analog=manifest_module.analog,
freq_40MHz=args.freq_40MHz,
)
counter += 1
test.close_devices()
Expand Down
1 change: 0 additions & 1 deletion silicon_tests/caravel/bitbang_i/bitbang_i.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <common.h>
#include <bitbang.h>
#define PULSE_WIDTH 100000

/*
@ send on the next io (start from 0 to 18)
Expand Down
Loading