Skip to content
Snippets Groups Projects
Commit ba430d41 authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

Added On/Off script + checked PLL settings

parent 6d62648f
No related branches found
No related tags found
No related merge requests found
......@@ -26,14 +26,11 @@ else:
DEBUG = False
I2CBUSNR=3
sleep_time = 0.05
PWR_RST = False
SET_PLL = True
READ_LOCK = True
INT_POWER_CYCLE = False
RESET_PLL = False
UPDATE_PLL = False
READ_ALL = False
CHECK_EEPROM = True
CLK_FREQ = '200MHz'
dev_i2c_eeprom = I2C(0x50)
dev_i2c_eeprom.bus_nr = I2CBUSNR
......@@ -131,6 +128,8 @@ def setup_pll(pll_frequency='200MHz') :
print("Set PLL to 200 MHz mode")
pll_address=PLL_200M
I2C_device.write_bytes(0x03, 0xF8)
Write_byte_PLL(0x03, 0x08, pll_address)
Write_byte_PLL(0x04, 0xCF, pll_address) # CF disable not used outputs, 00 enable all
Write_byte_PLL(0x05, 0x97, pll_address)
Write_byte_PLL(0x06, 0x10, pll_address) # cp inv = 0xF4 other 0xE4
Write_byte_PLL(0x07, 0x04, pll_address) # Divider R = 1 dec
......@@ -150,14 +149,22 @@ def setup_pll(pll_frequency='200MHz') :
def power(state):
ADDRESS_IO = 0x20
I2C_IO_device = I2C(ADDRESS_IO, BUSNR=I2CBUSNR)
I2C_IO_device.write_bytes(0x06, 0x2C)
I2C_IO_device.write_bytes(0x07, 00)
I2C_IO_device_A = I2C(ADDRESS_IO, BUSNR=I2CBUSNR)
I2C_IO_device_A.write_bytes(0x06, 0x2C) # '0' is output
I2C_IO_device_A.write_bytes(0x07, 0x00) # '0' is output
I2C_IO_device_B = I2C(ADDRESS_IO, BUSNR=I2CBUSNR)
I2C_IO_device_B.write_bytes(0x06, 0x2C) # '0' is output
if state:
bits_to_set = 0x42
bits_to_set_A1 = 0x02 | (1 << CS) | (0 << SCLK) | (0 << SDI)
bits_to_set_A2 = 0x04
bits_to_set_B1 = 0x02 | (1 << CS) | (0 << SCLK) | (0 << SDI)
else:
bits_to_set = 0x40
I2C_IO_device.write_bytes(0x02, bits_to_set)
bits_to_set_A1 = 0x00 | (1 << CS) | (0 << SCLK) | (0 << SDI)
bits_to_set_A2 = 0x00
bits_to_set_B1 = 0x00 | (1 << CS) | (0 << SCLK) | (0 << SDI)
I2C_IO_device_A.write_bytes(0x03, bits_to_set_A1)
I2C_IO_device_A.write_bytes(0x03, bits_to_set_A2)
I2C_IO_device_A.write_bytes(0x03, bits_to_set_B1)
def write_eeprom( data=0x01):
#
......@@ -213,16 +220,6 @@ if INT_POWER_CYCLE :
Write_byte_PLL(0x03, 0x08) # Device up
print("Done")
if RESET_PLL :
print("Reset PLL")
Write_byte_PLL(0x03, 0x0C) # Device reset
print("Enable PLL")
Write_byte_PLL(0x03, 0x08) # Device reset
sleep(0.1)
print("Done")
if READ_LOCK:
if CLK_FREQ == '160MHz' :
pll_addr = PLL_160M
......@@ -237,9 +234,3 @@ if READ_LOCK:
else:
print("Not locked --> PLL Error")
if READ_ALL:
Read_byte_PLL(0x00, nof_bytes = 23)
if UPDATE_PLL:
Write_byte_PLL(0x05, 0x97)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment