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

Sensor test not working

parent ffab720b
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,11 @@ else: ...@@ -26,11 +26,11 @@ else:
DEBUG = False DEBUG = False
I2CBUSNR=3 I2CBUSNR=3
sleep_time = 0.05 sleep_time = 0.05
SET_PLL = True SET_PLL = False
READ_LOCK = True READ_LOCK = False
READ_ALL = False READ_ALL = False
CHECK_EEPROM = True CHECK_EEPROM = False
PWR_RST = True PWR_RST = False
READ_SENSOR = True READ_SENSOR = True
CLK_FREQ = '200MHz' CLK_FREQ = '200MHz'
...@@ -209,10 +209,10 @@ def apsct_sensors(): ...@@ -209,10 +209,10 @@ def apsct_sensors():
Vref = 3.0 Vref = 3.0
one_step = Vref/(2**(16+1)) one_step = Vref/(2**(16+1))
I2C_device = I2C(addr, BUSNR=I2CBUSNR) I2C_device = I2C(addr, BUSNR=I2CBUSNR)
I2C_device.write_bytes(0xB8, 0xB0) I2C_device.write_bytes(0xB0, 0xB8)
sleep(1) sleep(1)
ret_ack, ret_value = I2C_device.read_last_reg(3) ret_ack, ret_value = I2C_device.read_last_reg(3)
if ret_ack: if 1: #ret_ack:
stri = "Return value input 0 : 0x{0} ".format(ret_value) stri = "Return value input 0 : 0x{0} ".format(ret_value)
print(stri) print(stri)
if int(ret_value, 16) >= 0xC00000: if int(ret_value, 16) >= 0xC00000:
...@@ -223,7 +223,9 @@ def apsct_sensors(): ...@@ -223,7 +223,9 @@ def apsct_sensors():
string = "Voltage is {0:.4f}".format(voltage) string = "Voltage is {0:.4f}".format(voltage)
print(string) print(string)
else: else:
print("ACK nok") stri = " No ACK on device 0x{0:x} ".format(addr)
print(stri)
if 0:
sleep(1) sleep(1)
temp_slope = 93.5E-6 * 2**(16+1) / Vref temp_slope = 93.5E-6 * 2**(16+1) / Vref
I2C_device.write_bytes(0xA0, 0xE0) I2C_device.write_bytes(0xA0, 0xE0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment