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

Update register settings. (before adding LOL)

parent 4bc28405
No related branches found
No related tags found
No related merge requests found
......@@ -27,14 +27,14 @@ DEBUG = False
I2CBUSNR=5
sleep_time = 0.15
SET_PLL = True
READ_LOCK = False #True
READ_ALL = True #False
READ_LOCK = True
READ_ALL = False
CHECK_EEPROM = False
PWR_RST = True #False
PWR_RST = False #True #False
READ_SENSOR = True
READ_REGS = False #True
CLK_FREQ = '200MHz'
CLK_FREQ = '200MHz' #'160MHz'
dev_i2c_eeprom = I2C(0x50)
dev_i2c_eeprom.bus_nr = I2CBUSNR
......@@ -156,8 +156,11 @@ def setup_pll(pll_frequency='200MHz') :
print("Set PLL to 200 MHz mode")
pll_address=PLL_200M
I2C_device.write_bytes(0x03, 0xFF)
Write_byte_PLL(0x03, 0x0C, pll_address)
sleep(0.5)
Write_byte_PLL(0x03, 0x08, pll_address)
Write_byte_PLL(0x03, 0x08, pll_address)
Write_byte_PLL(0x04, 0x00, pll_address) # CF disable not used outputs, 00 enable all
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
......@@ -169,11 +172,11 @@ def setup_pll(pll_frequency='200MHz') :
else:
Write_byte_PLL(0x0A, 0x14, pll_address)
Write_byte_PLL(0x09, 0x00, pll_address)
Write_byte_PLL(0x0C, 0x80, pll_address)
Write_byte_PLL(0x0D, 0x01, pll_address) # Dig CLK = 200/1 = 200 MHz
Write_byte_PLL(0x0F, 0x01, pll_address) # RCU CLK = 200/1 = 200 MHz
Write_byte_PLL(0x11, 0x01, pll_address) # PPS ref CLK = 200/1 = 200 MHz
Write_byte_PLL(0x13, 0x01, pll_address) # T.P. CLK = 200/1 = 200 MHz
Write_byte_PLL(0x0C, 0x8F, pll_address)
Write_byte_PLL(0x0D, 0x88, pll_address) # Dig CLK = 200/1 = 200 MHz
Write_byte_PLL(0x0F, 0x08, pll_address) # RCU CLK = 200/1 = 200 MHz
Write_byte_PLL(0x11, 0x08, pll_address) # PPS ref CLK = 200/1 = 200 MHz
Write_byte_PLL(0x13, 0x88, pll_address) # T.P. CLK = 200/1 = 200 MHz
def power(state):
......@@ -274,9 +277,9 @@ def read_temp():
one_step = Vref/(2**(16))
I2C_device = I2C(addr, BUSNR=I2CBUSNR)
temp_slope = 93.5E-6 * 2**(16+1) / Vref
sleep(0.5)
sleep(1.0)
I2C_device.write_bytes(0xA0, 0xC0)
sleep(0.5)
sleep(1.0)
ret_ack, ret_value = I2C_device.read_last_reg(3)
if ret_ack:
raw_value = (int(ret_value, 16) & 0x1FFFFF) >> 6
......@@ -290,6 +293,8 @@ def read_temp():
#if READ_REGS:
# read_all_regs_pll(CLK_FREQ)
read_temp()
if CHECK_EEPROM :
wr_rd_eeprom()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment