Skip to content

Commit

Permalink
Possible fix for #4
Browse files Browse the repository at this point in the history
  • Loading branch information
kanflo committed Apr 10, 2017
1 parent a30d1f3 commit 24a83f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions opendps/hw.c
Expand Up @@ -379,10 +379,12 @@ static void gpio_init(void)
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO3);
gpio_set(GPIOA, GPIO3);

// PA4 I 0 An DAC1_OUT PWM.2 (1IN-)
// DAC1_OUT and DAC2_OUT controls the output voltage via a TL594 Pulse-Width-Modulation Control Circuit
// http://www.ti.com/product/tl594?qgpn=tl594
// PA4 I 0 An DAC1_OUT TL594.2 (1IN-)
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO4);

// PA5 I 0 An DAC2_OUT PWM.15 (2IN-)
// PA5 I 0 An DAC2_OUT TL594.15 (2IN-)
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO5);

// PA6 I 1 PuPd
Expand Down Expand Up @@ -415,7 +417,7 @@ static void gpio_init(void)
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO14);
gpio_set(GPIOA, GPIO14);

// PA15 O 1 OD (50 Mhz) R41-PWM.16 (PWM 2IN+)
// PA15 O 1 OD (50 Mhz) R41-TL594.16 (2IN+)
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO15);

// PB0 I 0 An R7/R2-R14-D4
Expand Down Expand Up @@ -589,7 +591,7 @@ static void dac_init(void)
DAC_CR = 0; // 0x40007400 disable
DAC_SWTRIGR = 0x00000000; // 0x40007404
DAC_DHR12R1 = 0x00000000; // 0x40007408 0V output
DAC_DHR12R2 = 0x000001d6; // 0x40007414
DAC_DHR12R2 = 0x00000000; // 0x40007414
DAC_CR = 0x00030003; // 0x40007400 BOFF2, EN2, BOFF1, EN1
}

Expand Down
2 changes: 2 additions & 0 deletions opendps/pwrctl.c
Expand Up @@ -57,6 +57,8 @@ bool pwrctl_set_vout(uint32_t value_mv)
/** @todo Check with max Vout, currently filtered by ui.c */
v_out = value_mv;
DAC_DHR12R1 = pwrctl_calc_vout_dac(v_out);
/** @todo Check how the stock FW uses DAC1_OUT and DAC2_OUT to hold the voltage at high loads */
DAC_DHR12R2 = 0xfff;
return true;
}

Expand Down

0 comments on commit 24a83f8

Please sign in to comment.