diff --git a/platformio.ini b/platformio.ini index 6299ba4..cef4663 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,7 +13,7 @@ default_envs = # mppt-1210-hus-v0.2 # mppt-1210-hus-v0.4 # mppt-1210-hus-v0.6 -# pwm-2420-lus-v0.1 +# mppt-1210-hus-v0.7 # pwm-2420-lus-v0.2 # unit-test-native @@ -77,16 +77,17 @@ board = nucleo_l073rz build_flags = ${env.build_flags} -D MPPT_1210_HUS_0V4 +# https://github.com/LibreSolar/mppt-1210-hus/releases/tag/v0.6 [env:mppt-1210-hus-v0.6] board = nucleo_l073rz build_flags = ${env.build_flags} - -D MPPT_1210_HUS_0V6 + -D MPPT_1210_HUS_0V7 -# initial test version (obsolete) -[env:pwm-2420-lus-v0.1] +# https://github.com/LibreSolar/MPPT-1210-HUS +[env:mppt-1210-hus-v0.7] board = nucleo_l073rz build_flags = ${env.build_flags} - -D PWM_2420_LUS_0V1 + -D MPPT_1210_HUS_0V7 # https://github.com/LibreSolar/PWM-2420-LUS [env:pwm-2420-lus-v0.2] diff --git a/src/pcb.h b/src/pcb.h index 456c645..cc83908 100644 --- a/src/pcb.h +++ b/src/pcb.h @@ -61,10 +61,8 @@ #include "pcbs/mppt_1210_hus_0v2.h" #elif defined(MPPT_1210_HUS_0V4) #include "pcbs/mppt_1210_hus_0v4.h" -#elif defined(MPPT_1210_HUS_0V6) - #include "pcbs/mppt_1210_hus_0v6.h" -#elif defined(PWM_2420_LUS_0V1) - #include "pcbs/pwm_2420_lus_0v1.h" +#elif defined(MPPT_1210_HUS_0V7) + #include "pcbs/mppt_1210_hus_0v7.h" #elif defined(PWM_2420_LUS_0V2) #include "pcbs/pwm_2420_lus_0v2.h" #elif defined(UNIT_TEST) diff --git a/src/pcbs/mppt_1210_hus_0v6.h b/src/pcbs/mppt_1210_hus_0v7.h similarity index 97% rename from src/pcbs/mppt_1210_hus_0v6.h rename to src/pcbs/mppt_1210_hus_0v7.h index 740ee7a..2bd75b0 100644 --- a/src/pcbs/mppt_1210_hus_0v6.h +++ b/src/pcbs/mppt_1210_hus_0v7.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef MPPT_1210_HUS_0V6_H -#define MPPT_1210_HUS_0V6_H +#ifndef MPPT_1210_HUS_0V7_H +#define MPPT_1210_HUS_0V7_H #define DEVICE_TYPE "MPPT-1210-HUS" -#define HARDWARE_VERSION "v0.6" +#define HARDWARE_VERSION "v0.7.1" #include "mbed.h" diff --git a/src/pcbs/pwm_2420_lus_0v1.h b/src/pcbs/pwm_2420_lus_0v1.h deleted file mode 100644 index 739749b..0000000 --- a/src/pcbs/pwm_2420_lus_0v1.h +++ /dev/null @@ -1,118 +0,0 @@ -/* LibreSolar charge controller firmware - * Copyright (c) 2016-2019 Martin Jäger (www.libre.solar) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef PWM_2420_LUS_0V1_H -#define PWM_2420_LUS_0V1_H - -#define DEVICE_TYPE "PWM-2420-LUS" -#define HARDWARE_VERSION "v0.1" - -#include "mbed.h" - -#define CHARGER_TYPE_PWM 1 // PWM charge controller instead of MPPT - -#define PWM_TIM 3 // use TIM3 timer - -#define DCDC_CURRENT_MAX 20 // PCB maximum DCDC output current -#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current - -#define LOW_SIDE_VOLTAGE_MAX 30 // Maximum voltage at battery port (V) -#define HIGH_SIDE_VOLTAGE_MAX 55 // Maximum voltage at PV input port (V) - -#define PIN_UEXT_TX PA_2 -#define PIN_UEXT_RX PA_3 -#define PIN_UEXT_SCL PB_6 -#define PIN_UEXT_SDA PB_7 -#define PIN_UEXT_MISO PA_11 -#define PIN_UEXT_MOSI PA_12 -#define PIN_UEXT_SCK PB_3 -#define PIN_UEXT_SSEL PA_15 - -#define PIN_SWD_TX PA_9 -#define PIN_SWD_RX PA_10 - -#define PIN_LOAD_DIS PB_2 -#define PIN_USB_PWR_DIS PB_5 -#define PIN_I_LOAD_COMP PB_4 - -#define PIN_REF_I_DCDC PA_4 - -#define PIN_TEMP_INT_PD PA_8 - -enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT }; - -// assignment LED numbers on PCB to their meaning -#define NUM_LEDS 5 - -#define LED_RXTX 0 // LED1, used to indicate when sending data -#define LED_SOC_1 1 // LED2 -#define LED_SOC_2 2 // LED3 -#define LED_SOC_3 3 // LED4 -#define LED_LOAD 4 // LED5 - -// LED pins and pin state configuration to switch above LEDs on -#define NUM_LED_PINS 3 -static const PinName led_pins[NUM_LED_PINS] = { - // A B C - PB_13, PB_15, PB_14 -}; -static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { - { PIN_FLOAT, PIN_HIGH, PIN_LOW }, // LED1 - { PIN_FLOAT, PIN_LOW, PIN_HIGH }, // LED2 - { PIN_HIGH, PIN_LOW, PIN_FLOAT }, // LED3 - { PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED4 - { PIN_HIGH, PIN_FLOAT, PIN_LOW } // LED5 -}; - -// pin definition only needed in adc_dma.cpp to detect if they are present on the PCB -#define PIN_ADC_TEMP_BAT - -// typical value for Semitec 103AT-5 thermistor: 3435 -#define NTC_BETA_VALUE 3435 -#define NTC_SERIES_RESISTOR 10400.0 - -#define ADC_GAIN_V_BAT (132 / 12) -#define ADC_GAIN_V_SOLAR (1 + 120/12 + 120/8.2) -#define ADC_GAIN_I_LOAD (1000 / 2 / (68.0/2.2)) // amp gain: 150/2.2, resistor: 2 mOhm -#define ADC_GAIN_I_SOLAR (1000 / 2 / (68.0/2.2)) - -#define ADC_OFFSET_V_SOLAR (-120.0 / 8.2) // to be multiplied with VDDA to get absolute voltage offset - - -// position in the array written by the DMA controller -enum { - ADC_POS_V_BAT, // ADC 0 (PA_0) - ADC_POS_V_SOLAR, // ADC 1 (PA_1) - ADC_POS_I_LOAD, // ADC 5 (PA_5) - ADC_POS_I_SOLAR, // ADC 6 (PA_6) - ADC_POS_TEMP_BAT, // ADC 7 (PA_7) - ADC_POS_VREF_MCU, // ADC 17 - ADC_POS_TEMP_MCU, // ADC 18 - NUM_ADC_CH // trick to get the number of elements -}; - -// selected ADC channels (has to match with above enum) -#define ADC_CHSEL ( \ - ADC_CHSELR_CHSEL0 | \ - ADC_CHSELR_CHSEL1 | \ - ADC_CHSELR_CHSEL5 | \ - ADC_CHSELR_CHSEL6 | \ - ADC_CHSELR_CHSEL7 | \ - ADC_CHSELR_CHSEL17 | \ - ADC_CHSELR_CHSEL18 \ -) - -#endif