Add DC/DC HV side output enable switch
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
leds {
|
leds {
|
||||||
compatible = "gpio-leds";
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
pwr {
|
pwr {
|
||||||
gpios = <&gpioc 15 GPIO_ACTIVE_HIGH>;
|
gpios = <&gpioc 15 GPIO_ACTIVE_HIGH>;
|
||||||
label = "Power LED";
|
label = "Power LED";
|
||||||
@@ -46,21 +47,29 @@
|
|||||||
|
|
||||||
outputs {
|
outputs {
|
||||||
compatible = "outputs";
|
compatible = "outputs";
|
||||||
|
|
||||||
pwm_switch {
|
pwm_switch {
|
||||||
label = "PWM power switch (solar panel)";
|
label = "PWM power switch (solar panel)";
|
||||||
pwms = <&pwm3 2 (20*1000*1000)>; /* 20 ms period = 50 Hz */
|
pwms = <&pwm3 2 (20*1000*1000)>; /* 20 ms period = 50 Hz */
|
||||||
current-max = <20>;
|
current-max = <20>;
|
||||||
kconfig-flag; /* make node visible in Kconfig */
|
kconfig-flag; /* make node visible in Kconfig */
|
||||||
};
|
};
|
||||||
|
|
||||||
load {
|
load {
|
||||||
label = "Load output";
|
label = "Load output";
|
||||||
gpios = <&gpiob 15 GPIO_ACTIVE_LOW>;
|
gpios = <&gpiob 15 GPIO_ACTIVE_LOW>;
|
||||||
current-max = <20>;
|
current-max = <20>;
|
||||||
};
|
};
|
||||||
|
|
||||||
charge_pump {
|
charge_pump {
|
||||||
label = "Charge pump for HS MOSFET drivers";
|
label = "Charge pump for HS MOSFET drivers";
|
||||||
pwms = <&pwm8 1 200000>; /* 200 us period = 5 kHz */
|
pwms = <&pwm8 1 200000>; /* 200 us period = 5 kHz */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hv-ext-sense {
|
||||||
|
label = "HV external sense and switch";
|
||||||
|
gpios = <&gpiob 12 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
adc-inputs {
|
adc-inputs {
|
||||||
|
|||||||
@@ -51,6 +51,11 @@
|
|||||||
label = "CAN disable / standby";
|
label = "CAN disable / standby";
|
||||||
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
|
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hv-ext-sense {
|
||||||
|
label = "HV external sense and switch";
|
||||||
|
gpios = <&gpiob 12 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
adc-inputs {
|
adc-inputs {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
|
|
||||||
|
#ifndef UNIT_TEST
|
||||||
|
#include <drivers/gpio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <math.h> // for fabs function
|
#include <math.h> // for fabs function
|
||||||
#include <stdlib.h> // for min/max function
|
#include <stdlib.h> // for min/max function
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -290,4 +294,22 @@ void Dcdc::fuse_destruction()
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dcdc::output_hvs_enable()
|
||||||
|
{
|
||||||
|
#ifdef DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER
|
||||||
|
struct device *dev_hv_ext = device_get_binding(DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER);
|
||||||
|
gpio_pin_configure(dev_hv_ext, DT_OUTPUTS_HV_EXT_SENSE_GPIOS_PIN,
|
||||||
|
DT_OUTPUTS_HV_EXT_SENSE_GPIOS_FLAGS | GPIO_OUTPUT_ACTIVE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dcdc::output_hvs_disable()
|
||||||
|
{
|
||||||
|
#ifdef DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER
|
||||||
|
struct device *dev_hv_ext = device_get_binding(DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER);
|
||||||
|
gpio_pin_configure(dev_hv_ext, DT_OUTPUTS_HV_EXT_SENSE_GPIOS_PIN,
|
||||||
|
DT_OUTPUTS_HV_EXT_SENSE_GPIOS_FLAGS | GPIO_OUTPUT_INACTIVE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* DT_COMPAT_DCDC */
|
#endif /* DT_COMPAT_DCDC */
|
||||||
|
|||||||
+11
@@ -130,6 +130,17 @@ private:
|
|||||||
* @returns 0 if everything is fine, error number otherwise
|
* @returns 0 if everything is fine, error number otherwise
|
||||||
*/
|
*/
|
||||||
int perturb_observe_controller();
|
int perturb_observe_controller();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If manual control of the reverse polarity MOSFET on the high-side is available, this
|
||||||
|
* function enables it to use the high voltage side as output.
|
||||||
|
*/
|
||||||
|
void output_hvs_enable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the reverse polarity MOSFET on the high-sied (if option available)
|
||||||
|
*/
|
||||||
|
void output_hvs_disable();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user