Skip to content
Snippets Groups Projects
Commit 8755a0cc authored by Paulus Kruger's avatar Paulus Kruger
Browse files

DTH i2c fixed

parent b37ab722
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,7 @@ device_registers:
dim: 3
description: CW dither source
device: SI4012
driver: [I2Cbb1,I2Cbb1,I2Cbb1]
driver: [I2Cbb1,I2Cbb2,I2Cbb3]
address: 0x70
registers:
- name: Freq
......@@ -204,6 +204,9 @@ device_registers:
address: [0x1221,0x1121]
- name: CONF
address: [0x1210,0x1110]
# - name: POWER
# address: [0x1260,0x1160]
# store: True
variables:
- name: Ant_mask
......@@ -409,10 +412,10 @@ variables:
devreg: [IO3.GPIO1,IO3.GPIO1,IO3.GPIO2]
width: 1
bitoffset: [7,6,7]
rw: ro
rw: rw
dtype: boolean
dim: 96
mask: ANT_mask
mask: Ant_mask
- name: ANT_PWR_ON
driver: I2C_RCU
......@@ -687,24 +690,24 @@ methods:
- RCU_DTH_config : [0,0,0]
# - RCU_DTH_tune : [0,0,0,0,0,0]
# - DTH1.CONF : 0
# - DTH1.Tune : [0,0] #no tuning
- DTH1.Tune : [0,0] #no tuning
- DTH2.Tune : [0,0] #no tuning
- DTH3.Tune : [0,0] #no tuning
- RCU_DTH_tune: Update #debug
# - WAIT: 10
# - DTH1.Start : [1,0,0,0,1,0x55]
- DTH1.Start : [0,1,0,0,1]
# - DTH1.0x60: #PA_config...
# - DTH2.CONF : 0
# - WAIT: 10
# - DTH2.Tune : [0,0] #no tuning
# - WAIT: 10
- DTH2.Start : [0,1,0,0,1]
# - DTH3.CONF : 0
# - WAIT: 10
# - DTH3.Tune : [0,0] #no tuning
# - WAIT: 10
- DTH3.Start : [0,1,0,0,1]
- RCU_DTH_ON : Update
- RCU_DTH_config: Update #debug
- RCU_DTH_tune: Update #debug
# - RCU_DTH_config: Update #debug
- name: DTH_off
driver: I2C_RCU
......@@ -716,10 +719,10 @@ methods:
# - WAIT: 100
# - RCU_DTH_SHUTDOWN : [0,0,0]
# - RCU_DTH_SHUTDOWN : 1
- DTH1.Stop : [0,0]
- DTH2.Stop : [0,0]
- DTH3.Stop : [0,0]
- DTH2.Stop : [0,0]
- DTH1.Stop : [0,0]
- RCU_DTH_ON: Update
# - DTH1.State : [0,0]
# - DTH2.State : [0,0]
# - DTH3.State : [0,0]
- RCU_DTH_ON: Update
......@@ -151,7 +151,7 @@ device_registers:
dim: 3
description: CW dither source
device: SI4012
driver: [I2Cbb1,I2Cbb1,I2Cbb1]
driver: [I2Cbb1,I2Cbb2,I2Cbb3]
address: 0x70
registers:
- name: Freq
......
......@@ -181,7 +181,7 @@ device_registers:
dim: 3
description: CW dither source
device: SI4012
driver: [I2Cbb1,I2Cbb1,I2Cbb1]
driver: [I2Cbb1,I2Cbb2,I2Cbb3]
address: 0x70
registers:
- name: Freq
......
......@@ -51,7 +51,7 @@ class i2cbitbang1(hwdev):
logging.info(str(("I2Cbb set",hex(ADC_address),value)))
SetI2C(DIRdev,1,DIRpin,[1]) #Input = high
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high for start
#start
SetI2C(SDAdev,1,SDApin,[0]) #Output = low
SetI2C(DIRdev,1,DIRpin,[0]) #Output = low
......@@ -78,6 +78,7 @@ class i2cbitbang1(hwdev):
SetI2C(DIRdev,1,DIRpin,[0]) #low
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high
SetI2C(DIRdev,1,DIRpin,[1]) #Input = high
SetI2C(CLKdev,1,CLKpin,[0]) #keep low between transmission to not generate stop/start when other i2c actice
return True;
......@@ -96,7 +97,7 @@ class i2cbitbang1(hwdev):
logging.info(str(("I2Cbb get",hex(ADC_address),value)))
SetI2C(DIRdev,1,DIRpin,[1]) #Input = high
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high for start bit
#start
SetI2C(SDAdev,1,SDApin,[0]) #Output = low
SetI2C(DIRdev,1,DIRpin,[0]) #Output = low
......@@ -134,13 +135,15 @@ class i2cbitbang1(hwdev):
return b;
TXbyte(ADC_address);
print("si status:",hex(RXbyte()))#should be 0x80
status=RXbyte(last=(len(value)==0))
# if not(RXbyte()==0x80): return False;
for i in range(len(value)):
value[i]=RXbyte(last=(i==len(value)-1))
print("si status:",hex(status),[hex(v) for v in value])#should be 0x80
#stop
#SetI2C(DIRdev,1,DIRpin,[0]) #low
SetI2C(CLKdev,1,CLKpin,[1]) #Should be high
SetI2C(CLKdev,1,CLKpin,[1])
SetI2C(DIRdev,1,DIRpin,[1]) #Input = high
SetI2C(CLKdev,1,CLKpin,[0]) #keep low between transmission to not generate stop/start when other i2c actice
return True;
\ No newline at end of file
......@@ -4,19 +4,21 @@ from test_common import *
RCU=4;
setAntmask([RCU])
setRCUmask([RCU])
#call_debug_method("DTH_off")
if False:
if True:
name="RCU_DTH_freq"
Freq=[102e6,102.1e6,102.2e6]
Freq=[102e6,102.101e6,102.2e6]
# Freq=[102.2e6,102.1e6,102.0e6]
# Freq=[0,0,0]
att=get_value(name+"_R")
print("freq old:",att[3*RCU:3*RCU+3])
att[3*RCU:3*RCU+3]=[int(x) for x in Freq]
print("freq set:",att[3*RCU:3*RCU+3])
set_value(name+"_RW",att)
time.sleep(0.5)
att=get_value(name+"_R")
print("freq new :",att[3*RCU:3*RCU+3])
call_debug_method("DTH_on")
#call_debug_method("DTH_off")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment