kopia lustrzana https://github.com/SP8EBC/ParaTNC
bigfuxes: unwanted RTC initialization each start, bug in PT reference resistor index.... specific powersave changes, not enabling vbat_c from pwr_save, it will be handled by max31865 driver
rodzic
55e5d36621
commit
2f2cb1b11d
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
|
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
|
||||||
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="GPIOA"/> <peripheral name="GPIOB"/> </peripherals> "/>
|
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="GPIOA"/> <peripheral name="GPIOB"/> <peripheral name="RTC"/> </peripherals> "/>
|
||||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
|
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
|
||||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
|
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
|
||||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
|
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
|
||||||
|
|
|
@ -299,7 +299,7 @@ int pwr_save_switch_mode_to_c0(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn ON +5V_S
|
// turn ON +5V_S
|
||||||
io___cntrl_vbat_s_enable();
|
//io___cntrl_vbat_s_enable(); //TODO: Tatry specific!!!
|
||||||
|
|
||||||
// turn ON +5V_R and VBATT_SW_R
|
// turn ON +5V_R and VBATT_SW_R
|
||||||
io___cntrl_vbat_r_enable();
|
io___cntrl_vbat_r_enable();
|
||||||
|
@ -334,7 +334,7 @@ int pwr_save_switch_mode_to_c1(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
||||||
io___cntrl_vbat_s_enable();
|
//io___cntrl_vbat_s_enable(); // TODO: tatry specific!!!
|
||||||
|
|
||||||
// turn ON +5V_R and VBATT_SW_R
|
// turn ON +5V_R and VBATT_SW_R
|
||||||
io___cntrl_vbat_r_enable();
|
io___cntrl_vbat_r_enable();
|
||||||
|
@ -435,7 +435,7 @@ int pwr_save_switch_mode_to_m4(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
||||||
io___cntrl_vbat_s_enable();
|
//io___cntrl_vbat_s_enable(); // TODO: tatry specific!!
|
||||||
|
|
||||||
// turn OFF +5V_R and VBATT_SW_R
|
// turn OFF +5V_R and VBATT_SW_R
|
||||||
io___cntrl_vbat_r_disable();
|
io___cntrl_vbat_r_disable();
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern uint8_t max31865_merasurements_error_counter;
|
||||||
extern int_average_t max31865_average;
|
extern int_average_t max31865_average;
|
||||||
extern uint8_t max31865_ok;
|
extern uint8_t max31865_ok;
|
||||||
|
|
||||||
void max31865_init(uint8_t rdt_type, uint8_t reference_resistor);
|
void max31865_init(uint8_t rdt_type, uint8_t reference_resistor_index);
|
||||||
void max31865_init_average(void);
|
void max31865_init_average(void);
|
||||||
void max31865_pool(void);
|
void max31865_pool(void);
|
||||||
int32_t max31865_get_pt100_result();
|
int32_t max31865_get_pt100_result();
|
||||||
|
|
|
@ -457,10 +457,10 @@ void system_clock_start_rtc_l4(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set date
|
// set date
|
||||||
RTC->DR = 0x00229110;
|
RTC->DR = 0x00229229;
|
||||||
|
|
||||||
// set time
|
// set time
|
||||||
RTC->TR = 0x00191311;
|
RTC->TR = 0x00170001; // UTC
|
||||||
|
|
||||||
// exit RTC set mode
|
// exit RTC set mode
|
||||||
RTC->ISR &= (0xFFFFFFFF ^ RTC_ISR_INIT);
|
RTC->ISR &= (0xFFFFFFFF ^ RTC_ISR_INIT);
|
||||||
|
@ -529,11 +529,11 @@ int system_clock_configure_rtc_l4(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (SystemRtcHasFailed == 0) {
|
if (SystemRtcHasFailed == 0) {
|
||||||
// starting and configuring the RTC itself
|
// starting and configuring the RTC itself
|
||||||
system_clock_start_rtc_l4();
|
system_clock_start_rtc_l4();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable access do backup domain
|
// disable access do backup domain
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
int32_t test;
|
int32_t test;
|
||||||
|
|
||||||
|
//tary specific
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
typedef enum max31865_pool_state_t {
|
typedef enum max31865_pool_state_t {
|
||||||
MAX_UNINITIALIZED,
|
MAX_UNINITIALIZED,
|
||||||
MAX_IDLE,
|
MAX_IDLE,
|
||||||
|
@ -76,6 +79,11 @@ max31865_pool_state_t max31865_current_state = MAX_UNINITIALIZED;
|
||||||
*/
|
*/
|
||||||
float max31865_rref = 0;
|
float max31865_rref = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* And it's index from the table
|
||||||
|
*/
|
||||||
|
uint8_t max31865_rref_index = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable is incremented from 0 up to 9 to pause measurement
|
* This variable is incremented from 0 up to 9 to pause measurement
|
||||||
* state machine into MAX_SHUTDOWN state. When it reach 9 measurement
|
* state machine into MAX_SHUTDOWN state. When it reach 9 measurement
|
||||||
|
@ -220,7 +228,7 @@ static void max31865_send_config_register(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void max31865_init(uint8_t rdt_type, uint8_t reference_resistor) {
|
void max31865_init(uint8_t rdt_type, uint8_t reference_resistor_index) {
|
||||||
|
|
||||||
uint8_t * rx_data;
|
uint8_t * rx_data;
|
||||||
|
|
||||||
|
@ -236,15 +244,17 @@ void max31865_init(uint8_t rdt_type, uint8_t reference_resistor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reference_resistor > 31) {
|
if (reference_resistor_index > 31) {
|
||||||
max31865_current_state = MAX_UNINITIALIZED;
|
max31865_current_state = MAX_UNINITIALIZED;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
max31865_rref = max31865_rref_lookup_table[reference_resistor];
|
max31865_rref = max31865_rref_lookup_table[reference_resistor_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
max31865_rref_index = reference_resistor_index;
|
||||||
|
|
||||||
// set filter to 50Hz
|
// set filter to 50Hz
|
||||||
max31865_filter_select = 1;
|
max31865_filter_select = 1;
|
||||||
|
|
||||||
|
@ -288,10 +298,10 @@ void max31865_pool(void) {
|
||||||
case MAX_IDLE:
|
case MAX_IDLE:
|
||||||
// MAX31865 is powered up but not initialized
|
// MAX31865 is powered up but not initialized
|
||||||
if (max31865_rdt_sensor_type == 1) {
|
if (max31865_rdt_sensor_type == 1) {
|
||||||
max31865_init(MAX_3WIRE, max31865_rref);
|
max31865_init(MAX_3WIRE, max31865_rref_index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
max31865_init(MAX_4WIRE, max31865_rref);
|
max31865_init(MAX_4WIRE, max31865_rref_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max31865_ok == 1) {
|
if (max31865_ok == 1) {
|
||||||
|
@ -386,18 +396,22 @@ void max31865_pool(void) {
|
||||||
max31865_vbias = 0;
|
max31865_vbias = 0;
|
||||||
|
|
||||||
// this function may change 'max31865_current_state' internally due to errors
|
// this function may change 'max31865_current_state' internally due to errors
|
||||||
max31865_send_config_register();
|
//max31865_send_config_register();
|
||||||
|
|
||||||
max31865_shutdown_ticks = 0;
|
max31865_shutdown_ticks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tatry specific
|
||||||
|
io___cntrl_vbat_s_disable();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MAX_SHUTDOWN:
|
case MAX_SHUTDOWN:
|
||||||
// MAX31865 is powered up and initialized but PT bias is disabled
|
// MAX31865 is powered up and initialized but PT bias is disabled
|
||||||
// and no measurement is ongoing
|
// and no measurement is ongoing
|
||||||
if (max31865_shutdown_ticks++ > MAX31865_INTERVAL) {
|
if (max31865_shutdown_ticks++ > MAX31865_INTERVAL) {
|
||||||
max31865_current_state = MAX_INITIALIZED;
|
io___cntrl_vbat_s_enable();
|
||||||
|
|
||||||
|
max31865_current_state = MAX_IDLE; //
|
||||||
|
|
||||||
max31865_shutdown_ticks = 0;
|
max31865_shutdown_ticks = 0;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue