From 04805783913ba02ab10c50ce047e5e4ea17bfb8c Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 13 Jul 2016 07:59:03 +1200 Subject: [PATCH] stlink: New discovery boards support. Patch from issue #103 --- src/platforms/stlink/usbdfu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platforms/stlink/usbdfu.c b/src/platforms/stlink/usbdfu.c index 1a2cbec..f5c30a9 100644 --- a/src/platforms/stlink/usbdfu.c +++ b/src/platforms/stlink/usbdfu.c @@ -67,7 +67,13 @@ static int stlink_test_nrst(void) GPIO_CNF_OUTPUT_PUSHPULL, led_idle_run); rcc_periph_clock_enable(RCC_GPIOB); gpio_set_mode(GPIOB, GPIO_MODE_INPUT, - GPIO_CNF_INPUT_PULL_UPDOWN, pin); + GPIO_CNF_INPUT_PULL_UPDOWN, pin | GPIO15); + if (gpio_get(GPIOB, GPIO15)) { + /* ST890 is active low */ + gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, + GPIO_CNF_OUTPUT_PUSHPULL, GPIO15); + gpio_clear(GPIOB, GPIO15); + } gpio_set(GPIOB, pin); systick_value = systick_get_value(); while (systick_get_value() > (systick_value - 20000)); /* Wait 20 msec*/