From 3ace84aece7c6254d9910be36243809588a2cb86 Mon Sep 17 00:00:00 2001 From: bcostm Date: Thu, 30 Jan 2014 10:13:16 +0100 Subject: [PATCH] [NUCLEO_F030R8] Change AF setting before GPIO setting --- .../hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c index 55c2294c80..6b8c243c37 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c @@ -83,6 +83,12 @@ void pin_function(PinName pin, int data) { // Enable GPIO clock uint32_t gpio_add = Set_GPIO_Clock(port_index); gpio = (GPIO_TypeDef *)gpio_add; + + // Configure Alternate Function + // Warning: Must be done before the GPIO is initialized + if (afnum != 0xFF) { + GPIO_PinAFConfig(gpio, (uint16_t)pin_index, afnum); + } // Configure GPIO GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index); @@ -91,11 +97,6 @@ void pin_function(PinName pin, int data) { GPIO_InitStructure.GPIO_OType = (GPIOOType_TypeDef)otype; GPIO_InitStructure.GPIO_PuPd = (GPIOPuPd_TypeDef)pupd; GPIO_Init(gpio, &GPIO_InitStructure); - - // Configure Alternate Function - if (afnum != 0xFF) { - GPIO_PinAFConfig(gpio, (uint16_t)pin_index, afnum); - } // *** TODO *** // Disconnect JTAG-DP + SW-DP signals.