kopia lustrzana https://github.com/SP8EBC/ParaTNC
fix in +5V_C voltage switching in ParaMETEO
rodzic
1cc9012867
commit
0dd67e45fb
|
@ -13,6 +13,7 @@ RM := rm -rf
|
|||
-include system/src/stm32f1-stdperiph/subdir.mk
|
||||
-include system/src/newlib/subdir.mk
|
||||
-include system/src/modbus_rtu/subdir.mk
|
||||
-include system/src/http_client/subdir.mk
|
||||
-include system/src/drivers/f1/subdir.mk
|
||||
-include system/src/drivers/subdir.mk
|
||||
-include system/src/diag/subdir.mk
|
||||
|
|
|
@ -35,6 +35,7 @@ system/src/davis_vantage \
|
|||
system/src/diag \
|
||||
system/src/drivers \
|
||||
system/src/drivers/f1 \
|
||||
system/src/http_client \
|
||||
system/src/modbus_rtu \
|
||||
system/src/newlib \
|
||||
system/src/stm32f1-stdperiph \
|
||||
|
|
|
@ -21,7 +21,6 @@ C_SRCS += \
|
|||
../src/it_handlers.c \
|
||||
../src/main.c \
|
||||
../src/packet_tx_handler.c \
|
||||
../src/pwr_switch.c \
|
||||
../src/rte_main.c \
|
||||
../src/rte_pv.c \
|
||||
../src/rte_pwr.c \
|
||||
|
@ -30,7 +29,8 @@ C_SRCS += \
|
|||
../src/wx_handler.c \
|
||||
../src/wx_handler_humidity.c \
|
||||
../src/wx_handler_pressure.c \
|
||||
../src/wx_handler_temperature.c
|
||||
../src/wx_handler_temperature.c \
|
||||
../src/wx_pwr_switch.c
|
||||
|
||||
OBJS += \
|
||||
./src/KissCommunication.o \
|
||||
|
@ -50,7 +50,6 @@ OBJS += \
|
|||
./src/it_handlers.o \
|
||||
./src/main.o \
|
||||
./src/packet_tx_handler.o \
|
||||
./src/pwr_switch.o \
|
||||
./src/rte_main.o \
|
||||
./src/rte_pv.o \
|
||||
./src/rte_pwr.o \
|
||||
|
@ -59,7 +58,8 @@ OBJS += \
|
|||
./src/wx_handler.o \
|
||||
./src/wx_handler_humidity.o \
|
||||
./src/wx_handler_pressure.o \
|
||||
./src/wx_handler_temperature.o
|
||||
./src/wx_handler_temperature.o \
|
||||
./src/wx_pwr_switch.o
|
||||
|
||||
C_DEPS += \
|
||||
./src/KissCommunication.d \
|
||||
|
@ -79,7 +79,6 @@ C_DEPS += \
|
|||
./src/it_handlers.d \
|
||||
./src/main.d \
|
||||
./src/packet_tx_handler.d \
|
||||
./src/pwr_switch.d \
|
||||
./src/rte_main.d \
|
||||
./src/rte_pv.d \
|
||||
./src/rte_pwr.d \
|
||||
|
@ -88,7 +87,8 @@ C_DEPS += \
|
|||
./src/wx_handler.d \
|
||||
./src/wx_handler_humidity.d \
|
||||
./src/wx_handler_pressure.d \
|
||||
./src/wx_handler_temperature.d
|
||||
./src/wx_handler_temperature.d \
|
||||
./src/wx_pwr_switch.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
|
@ -14,27 +14,33 @@
|
|||
* This header file defines all functions related to powersaving, switching between different power states,
|
||||
* stopping cpu core etc. Generally they are few power states as below
|
||||
*
|
||||
* /----------------------------------------------------------------------\
|
||||
* | State | CPU | +5V_S | +5V_R and VBATT_SW_R | +4V_G | +5V_C |
|
||||
* | | | | | | |
|
||||
* | | | sensors | Internal / external | GPRS | SD card |
|
||||
* | | | | VHF Radio | | PT100 |
|
||||
* =----------------------------------------------------------------------=
|
||||
* | C0 |Running| ON | ON | ON | ON |
|
||||
* | C1 |Running| ON | ON | OFF | ON |
|
||||
* | C2 |Running| OFF | ON | OFF | ON |
|
||||
* | C3 |Running| OFF | ON | ON | ON |
|
||||
* | M4 |Running| ON | OFF | OFF | OFF |
|
||||
* | I5 |Running| OFF | OFF | OFF | OFF |
|
||||
* | L6 | Stop2 | OFF | OFF | ON | OFF |
|
||||
* | L7 | Stop2 | OFF | OFF | OFF | OFF |
|
||||
* \----------------------------------------------------------------------/
|
||||
* /-------------------------------------------------------------------------\
|
||||
* | State | CPU | +5V_S | +7V5_R and VBATT_SW_R | +4V_G | +5V_C |
|
||||
* | | | VBATT_SW_S | | | |
|
||||
* =-------------------------------------------------------------------------=
|
||||
* | C0 |Running| ON | ON | ON | ON |
|
||||
* | C1 |Running| ON | ON | OFF | ON |
|
||||
* | C2 |Running| OFF | ON | OFF | ON |
|
||||
* | C3 |Running| OFF | ON | ON | ON |
|
||||
* | M4 |Running| ON | OFF | OFF | OFF |
|
||||
* | I5 |Running| OFF | OFF | OFF | OFF |
|
||||
* | L6 | Stop2 | OFF | OFF | ON | OFF |
|
||||
* | L7 | Stop2 | OFF | OFF | OFF | OFF |
|
||||
* \-------------------------------------------------------------------------/
|
||||
*
|
||||
* C = modes with communication enabled
|
||||
* M = mode with measuremenet only w/o any communication
|
||||
* I = idle / initialization mode with anything disabled
|
||||
* L = low power consumption modes with CPU halted in STOP2 mode
|
||||
*
|
||||
* What is supplied by which voltage
|
||||
* +3V3_C - Microcontroller and UART-RS232 converter. It is always present
|
||||
* +4V_G - GSM module
|
||||
* +5V_C and +3V3_CC derived from it - LMV358 op amp, microSD Cards, PT100 interface
|
||||
* +5V_S and +3V3_S derived from it - Wind sensor, one wire thermometer, RS485
|
||||
* +7V5_R - external VHF radio
|
||||
*
|
||||
*
|
||||
* Stop2 mode is a power saving mode defined in STM paperwork (DM0083560
|
||||
* aka Reference Manual RM0351). This mode halts CPU core completely and
|
||||
* disable HCLK, AHB1 & AHB2 buses, but preserves StaticRAM and registers
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
//#define PARATNC_HWREV_A
|
||||
//#define PARATNC_HWREV_B
|
||||
//#define PARATNC_HWREV_C
|
||||
#define PARAMETEO
|
||||
#define PARATNC_HWREV_C
|
||||
//#define PARAMETEO
|
||||
|
||||
#ifdef PARAMETEO
|
||||
// those defines and an undef are only required for shitty Eclipse indexer to see anything from STM32L471xx target
|
||||
|
|
|
@ -16,6 +16,7 @@ typedef enum wx_pwr_state_t {
|
|||
WX_PWR_DISABLED
|
||||
}wx_pwr_state_t;
|
||||
|
||||
extern wx_pwr_state_t wx_pwr_state;
|
||||
|
||||
void wx_pwr_switch_init(void);
|
||||
void wx_pwr_switch_periodic_handle(void);
|
19
src/io.c
19
src/io.c
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <wx_pwr_switch.h>
|
||||
#include "station_config_target_hw.h"
|
||||
|
||||
#include "io.h"
|
||||
|
@ -136,26 +137,28 @@ void io_ext_watchdog_config(void) {
|
|||
|
||||
void io_ext_watchdog_service(void) {
|
||||
#ifdef STM32F10X_MD_VL
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef STM32L471xx
|
||||
if ((GPIOA->ODR & GPIO_ODR_OD1) == 0) {
|
||||
if ((GPIOA->ODR & GPIO_ODR_ODR12) == 0) {
|
||||
// set high
|
||||
GPIOA->BSRR |= GPIO_BSRR_BS1;
|
||||
GPIOA->BSRR |= GPIO_BSRR_BS12;
|
||||
}
|
||||
else {
|
||||
// set low
|
||||
GPIOA->BSRR |= GPIO_BSRR_BR1;
|
||||
GPIOA->BSRR |= GPIO_BSRR_BR12;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STM32L471xx
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void io_vbat_meas_init(int8_t a_coeff, int8_t b_coeff) {
|
||||
|
||||
#ifdef STM32L471xx
|
||||
io_vbat_a_coeff = a_coeff;
|
||||
io_vbat_b_coeff = b_coeff;
|
||||
|
||||
#ifdef STM32L471xx
|
||||
|
||||
GPIO_InitTypeDef.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitTypeDef.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitTypeDef.Pin = LL_GPIO_PIN_5;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "io.h"
|
||||
#include "float_to_string.h"
|
||||
#include "pwr_save.h"
|
||||
#include "pwr_switch.h"
|
||||
#include <wx_pwr_switch.h>
|
||||
|
||||
#include "it_handlers.h"
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#include "pwr_switch.h"
|
||||
|
||||
#include <wx_pwr_switch.h>
|
||||
#include "station_config.h"
|
||||
#include "main.h"
|
||||
#include "rte_wx.h"
|
Ładowanie…
Reference in New Issue