From c9d34348bcce9ebea1a08cc0317c29e7cc47bd65 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Mon, 15 Apr 2024 15:28:20 +0800 Subject: [PATCH] fix adc and dac initialization --- fast-servo/pyfastservo/adc.py | 6 +++--- fast-servo/pyfastservo/dac.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fast-servo/pyfastservo/adc.py b/fast-servo/pyfastservo/adc.py index 69fefcf..e04a47e 100644 --- a/fast-servo/pyfastservo/adc.py +++ b/fast-servo/pyfastservo/adc.py @@ -54,7 +54,7 @@ def main_adc_config(test_pattern): spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE) spi.max_speed_hz = 50000 spi.mode = 0b00 # CPOL = 0 CPHA = 0 - spi.cshigh = True + spi.cshigh = False # spi.read0 = False spi_buffer = [0x00, 0x80] # reset @@ -121,7 +121,7 @@ def main_adc_test_mode(enable): spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE) spi.max_speed_hz = 50000 spi.mode = 0b00 # CPOL = 0 CPHA = 0 - spi.cshigh = True + spi.cshigh = False # spi.read0 = True reg_contents = ( @@ -292,7 +292,7 @@ def adc_aux_read(port, type, pin): spi.open(1, 3) # AUX ADC 1? spi.max_speed_hz = 5000 spi.mode = 0b00 - spi.cshigh = True + spi.cshigh = False read_buffer = spi.xfer2(write_buffer) mu_voltage = read_buffer[0] << 8 | read_buffer[1] >> 2 diff --git a/fast-servo/pyfastservo/dac.py b/fast-servo/pyfastservo/dac.py index e16a14a..a523ffc 100644 --- a/fast-servo/pyfastservo/dac.py +++ b/fast-servo/pyfastservo/dac.py @@ -45,7 +45,7 @@ def main_dac_init(): spi.open(MAIN_DAC_BUS, MAIN_DAC_DEVICE) spi.max_speed_hz = 5000 spi.mode = 0b00 # CPOL = 0 CPHA = 0 - spi.cshigh = True + spi.cshigh = False spi_buffer = [0x00, 0x10] # software reset spi.xfer2(spi_buffer)