0 Replies Latest reply on Oct 16, 2014 1:52 AM by forever_din

    (Solved)Can not initial STM32F2XX and STM32F4XX GPIO PIxx by SDK 3.x API

    forever_din

      Dear all,

       

      Our customer use SSBWMN01/SSBWMN02 module and use PIxx as generic GPIO. This is base on STM32F2x/STM32F4x

      WICED module. When they use SDK 2.x wiced_gpio_init() initial PIxx, it work fine and no any problem.

       

      But when they use SDK 3.x, PIxx IO can not work. The issue is about platform pin structure definition between SDK 2.x and 3.x:

      SDK 2.x definition :

      typedef struct

      {

          GPIO_TypeDef* bank;

          uint8_t       number;

          uint32_t      peripheral_clock;

      } platform_pin_mapping_t

      SDK 3.x definition :

      typedef struct

      {

          uint8_t port; /* GPIO port. platform_gpio_port_t is defined in <WICED-SDK>/MCU/<MCU>/platform_mcu_interface.h */

          uint8_t pin;  /* pin number. Valid range is defined in <WICED-SDK>/MCU/<MCU>/platform_mcu_interface.h         */

      } platform_gpio_t;

       

      SDK 2.x wiced_gpio_init() enable GPIO peripheral clock by platform_pin_mapping_t, but SDK 3.x use gpio_peripheral_clocks

      array to fnd which peripheral must enable. But SDK 3.x only define GPIOA~GPIOH in gpio_peripheral_clocks array.

      To fix PIxx initial issue, just modify "platform_mcu_peripheral.h" and "platform_gpio.c". The files location are :

      WICED-SDK-3.x.x\Wiced-SDK\WICED\platform\MCU\STM32F2xx\peripherals\

      Attachment is for STM32F2xx fixed file.

      Modify location :

      platform_gpio.c

      /* GPIO peripheral clocks */

      static const uint32_t gpio_peripheral_clocks[NUMBER_OF_GPIO_PORTS] =

      {

          [0] = RCC_AHB1Periph_GPIOA,

          [1] = RCC_AHB1Periph_GPIOB,

          [2] = RCC_AHB1Periph_GPIOC,

          [3] = RCC_AHB1Periph_GPIOD,

          [4] = RCC_AHB1Periph_GPIOE,

          [5] = RCC_AHB1Periph_GPIOF,

          [6] = RCC_AHB1Periph_GPIOG,

          [7] = RCC_AHB1Periph_GPIOH,

          [8] = RCC_AHB1Periph_GPIOI,

      };

      platform_mcu_peripheral.h

      /* GPIOA to I */

      #define NUMBER_OF_GPIO_PORTS      (9)

      Best regards