diff --git a/fast-servo/linien-server-add-afe_ctrl-regs.patch b/fast-servo/linien-server-add-afe_ctrl-regs.patch new file mode 100644 index 0000000..681d86d --- /dev/null +++ b/fast-servo/linien-server-add-afe_ctrl-regs.patch @@ -0,0 +1,34 @@ +diff --git a/linien-server/linien_server/parameters.py b/linien-server/linien_server/parameters.py +index 287f304..fe482d7 100644 +--- a/linien-server/linien_server/parameters.py ++++ b/linien-server/linien_server/parameters.py +@@ -154,6 +154,16 @@ class Parameters: + `error_signal_2_max`. + """ + ++ # ------------------- FAST SERVO PARAMETERS --------------------------------------- ++ self.adc_afe_10x_gain_1 = Parameter(start=0, min_=0, max_=1, restorable=True) ++ self.adc_afe_10x_gain_2 = Parameter(start=0, min_=0, max_=1, restorable=True) ++ """ ++ Configures Fast INs AFE Gain: ++ 0 --> 1x Gain ++ 1 --> 10x Gain ++ """ ++ ++ + # ------------------- GENERAL PARAMETERS --------------------------------------- + + self.mod_channel = Parameter(start=0, min_=0, max_=1, restorable=True) +diff --git a/linien-server/linien_server/registers.py b/linien-server/linien_server/registers.py +index 365c254..2b8f697 100644 +--- a/linien-server/linien_server/registers.py ++++ b/linien-server/linien_server/registers.py +@@ -173,6 +173,8 @@ class Registers: + gpio_n_do0_en=csrmap.signals.index("zero"), + gpio_n_do1_en=csrmap.signals.index("zero"), + logic_slow_decimation=16, ++ # Fast Servo Paramters ++ adc_afe_ctrl=(self.parameters.adc_afe_10x_gain_2.value << 1 | self.parameters.adc_afe_10x_gain_1.value) + ) + + for instruction_idx, [wait_for, peak_height] in enumerate( diff --git a/flake.nix b/flake.nix index 7826ac3..f1a7d50 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ ./fast-servo/linien-client-ssh-port-change.patch ./fast-servo/linien-server-fast-servo.patch ./fast-servo/linien-server-cli.patch + ./fast-servo/linien-server-add-afe_ctrl-regs.patch ./fast-servo/linien-gateware-fast-servo.patch ./fast-servo/linien-gateware-autolock-pipeline.patch ./fast-servo/linien-module-iir-coeff-width-set-to-18bit.patch