aboutsummaryrefslogtreecommitdiff
path: root/src/platforms
diff options
context:
space:
mode:
authorMichael Tharp2013-10-04 21:24:53 -0400
committerGareth McMullin2013-10-05 13:14:03 +0800
commitc395c6f73a220cd6da26ff3b48afde8487b6199f (patch)
tree049bc1f3f6179e8fd7654a5a5cc08217ee41f110 /src/platforms
parent3cce6f472c79efd53c474bb0173b9c2e2f43c5d4 (diff)
Configure SRST output as open-drain for BMP Mini hardware
Diffstat (limited to 'src/platforms')
-rw-r--r--src/platforms/native/platform.c11
-rw-r--r--src/platforms/native/platform.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/src/platforms/native/platform.c b/src/platforms/native/platform.c
index 44a5793..640ba58 100644
--- a/src/platforms/native/platform.c
+++ b/src/platforms/native/platform.c
@@ -98,10 +98,15 @@ int platform_init(void)
* to release the device from reset if this floats. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO7);
- /* Enable SRST output */
- gpio_set_val(SRST_PORT, SRST_PIN, platform_hwversion() > 0);
+ /* Enable SRST output. Original uses a NPN to pull down, so setting the
+ * output HIGH asserts. Mini is directly connected so use open drain output
+ * and set LOW to assert.
+ */
+ platform_srst_set_val(false);
gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_50_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL,
+ (platform_hwversion() == 0
+ ? GPIO_CNF_OUTPUT_PUSHPULL
+ : GPIO_CNF_OUTPUT_OPENDRAIN),
SRST_PIN);
/* Enable internal pull-up on PWR_BR so that we don't drive
diff --git a/src/platforms/native/platform.h b/src/platforms/native/platform.h
index 40dd620..20d1510 100644
--- a/src/platforms/native/platform.h
+++ b/src/platforms/native/platform.h
@@ -220,3 +220,4 @@ static inline uint16_t _gpio_get(uint32_t gpioport, uint16_t gpios)
#define disconnect_usb() gpio_set_mode(USB_PU_PORT, GPIO_MODE_INPUT, 0, USB_PU_PIN);
void assert_boot_pin(void);
void setup_vbus_irq(void);
+void platform_srst_set_val(bool assert);