From 68316f07357c1d76b5ec72f5761248473d85f182 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 27 Apr 2021 20:53:35 +1000 Subject: [PATCH] Fixing up ADC config --- source/Core/BSP/MHP30/Model_Config.h | 1 - source/Core/BSP/MHP30/Setup.c | 4 ++-- source/Core/Drivers/MSA301.cpp | 2 +- source/Core/Inc/configuration.h | 10 +++++----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/Core/BSP/MHP30/Model_Config.h b/source/Core/BSP/MHP30/Model_Config.h index da1bebcb..4c02bbee 100644 --- a/source/Core/BSP/MHP30/Model_Config.h +++ b/source/Core/BSP/MHP30/Model_Config.h @@ -16,7 +16,6 @@ #endif #ifdef MODEL_MHP30 -#define ACCEL_LIS #define ACCEL_MSA #define POW_PD //#define POW_QC // Unsure if we have this diff --git a/source/Core/BSP/MHP30/Setup.c b/source/Core/BSP/MHP30/Setup.c index d2bb1752..6aa2eda9 100644 --- a/source/Core/BSP/MHP30/Setup.c +++ b/source/Core/BSP/MHP30/Setup.c @@ -177,8 +177,8 @@ static void MX_ADC2_Init(void) { sConfig.Rank = ADC_REGULAR_RANK_2; HAL_ADC_ConfigChannel(&hadc2, &sConfig); sConfig.Channel = TIP_TEMP_ADC1_CHANNEL; - sConfig.Rank = ADC_REGULAR_RANK_2; - HAL_ADC_ConfigChannel(&hadc1, &sConfig); + sConfig.Rank = ADC_REGULAR_RANK_3; + HAL_ADC_ConfigChannel(&hadc2, &sConfig); // Run ADC internal calibration while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) diff --git a/source/Core/Drivers/MSA301.cpp b/source/Core/Drivers/MSA301.cpp index a3d64de8..97bb4a9d 100644 --- a/source/Core/Drivers/MSA301.cpp +++ b/source/Core/Drivers/MSA301.cpp @@ -7,7 +7,7 @@ #include "MSA301_defines.h" #include -#define MSA301_I2C_ADDRESS 0x4C +#define MSA301_I2C_ADDRESS 0x26<<1 bool MSA301::detect() { return FRToSI2C::probe(MSA301_I2C_ADDRESS); } static const FRToSI2C::I2C_REG i2c_registers[] = { diff --git a/source/Core/Inc/configuration.h b/source/Core/Inc/configuration.h index 654ab8f2..98b36747 100644 --- a/source/Core/Inc/configuration.h +++ b/source/Core/Inc/configuration.h @@ -164,11 +164,11 @@ #endif #ifdef MODEL_MHP30 -#define VOLTAGE_DIV 650 // Default for MHP30 TODO -#define PID_POWER_LIMIT 75 // Sets the max pwm power limit +#define VOLTAGE_DIV 350 // Default for MHP30 +#define PID_POWER_LIMIT 65 // Sets the max pwm power limit #define CALIBRATION_OFFSET 900 // the adc offset in uV #define POWER_LIMIT 65 // 65 watts default power limit -#define MAX_POWER_LIMIT 35 // +#define MAX_POWER_LIMIT 65 // #define POWER_LIMIT_STEPS 2 // #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // TODO #define TEMP_uV_LOOKUP_MHP30 // TODO @@ -196,6 +196,6 @@ const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips #endif #ifdef MODEL_MHP30 -const uint32_t tipMass = 80; // TODO -const uint8_t tipResistance = 65; // x10 ohms, 6 typical +const uint32_t tipMass = 100; // TODO +const uint8_t tipResistance = 75; // x10 ohms, ~6 typical #endif