Skip to main content
benyBoy
Associate III
April 24, 2017
Question

GPIO - arduino pin mapping for STM32F769I-discovery?

  • April 24, 2017
  • 2 replies
  • 3208 views
Posted on April 24, 2017 at 06:35

Hi , I have succesfuly managed to merge the GPIO example code into my project.

I am using the audio application project as the base project.

The GPIO button toggles the LED.

I would like to define 3 GPIO pins as digital ouputs on the arduino headers of the STM32F769I-discovery board

so far I have code below, but can't find the arduino pin : GPIO pin map ?

can arduino pins GPIO ? or should I be doing this a different way ? I just need to toggle 3 pins high and low.

static void EXTI0_GPIO_BEN(void)

{

  GPIO_InitTypeDef   GPIO_InitStructure;

  /* Enable GPIOC clock */

  __HAL_RCC_GPIOA_CLK_ENABLE();

// configure gpio pins for reset for external adc dsp and dac devices

// gpio reset for ADC

  GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;

  GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ?

  GPIO_InitStructure.Pin = GPIO_PIN_0;

  // gpio reset for DSP

  GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;

   GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ?

   GPIO_InitStructure.Pin = GPIO_PIN_1;

   // gpio reset for DAC

    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;

     GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ?

     GPIO_InitStructure.Pin = GPIO_PIN_1;

  HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);  /// go initilize pins ?

  // i don't think I need to have interrupts for this ??

 /* Enable and set EXTI line 0 Interrupt to the lowest priority */

 //  HAL_NVIC_SetPriority(EXTI0_IRQn, 2, 0);

 //  HAL_NVIC_EnableIRQ(EXTI0_IRQn);

}
    This topic has been closed for replies.

    2 replies

    waclawek.jan
    Super User
    April 24, 2017
    Posted on April 24, 2017 at 10:50

    so far I have code below, but can't find the arduino pin : GPIO pin map ?

    UM2033 Table 13 and Fig.33

    JW

    benyBoy
    benyBoyAuthor
    Associate III
    April 24, 2017
    Posted on April 24, 2017 at 11:43

     ,

     ,

    Hi waclawek,

    I looked at table 13 but cannot see how it relates to GPIO pin definition in example GPIO code.

    for example which physical pin in table 13 is GPIO_PIN_0 , ?

    GPIO_InitStructure.Pin = GPIO_PIN_0,

    from the table,

    pin number , , , , , , pin name  , , , , , label , , , , , , , , , , , , , , , , , , , , , comment

    C2 , , , , , , , , , , , , , , , , , , , , PI8 , , , , ,  ,  ,  ,  ,  , , GPIO_Input , , , , , , , , , NC4

    from GPIO example,

    /** @defgroup GPIO_pins_define GPIO pins define

     ,

     , * @{

     ,

     , */

     ,

    ♯ define GPIO_PIN_0 , , , , , , , , , , , , , , , , ((uint16_t)0x0001U) , /* Pin 0 selected , , , */

     ,

    ♯ define GPIO_PIN_1 , , , , , , , , , , , , , , , , ((uint16_t)0x0002U) , /* Pin 1 selected , , , */

     ,

    ♯ define GPIO_PIN_2 , , , , , , , , , , , , , , , , ((uint16_t)0x0004U) , /* Pin 2 selected , , , */

     ,

    ♯ define GPIO_PIN_3 , , , , , , , , , , , , , , , , ((uint16_t)0x0008U) , /* Pin 3 selected , , , */

     ,

    ♯ define GPIO_PIN_4 , , , , , , , , , , , , , , , , ((uint16_t)0x0010U) , /* Pin 4 selected , , , */

     ,

    ♯ define GPIO_PIN_5 , , , , , , , , , , , , , , , , ((uint16_t)0x0020U) , /* Pin 5 selected , , , */

     ,

    ♯ define GPIO_PIN_6 , , , , , , , , , , , , , , , , ((uint16_t)0x0040U) , /* Pin 6 selected , , , */

     ,

    ♯ define GPIO_PIN_7 , , , , , , , , , , , , , , , , ((uint16_t)0x0080U) , /* Pin 7 selected , , , */

     ,

    ♯ define GPIO_PIN_8 , , , , , , , , , , , , , , , , ((uint16_t)0x0100U) , /* Pin 8 selected , , , */

     ,

    ♯ define GPIO_PIN_9 , , , , , , , , , , , , , , , , ((uint16_t)0x0200U) , /* Pin 9 selected , , , */

     ,

    ♯ define GPIO_PIN_10 , , , , , , , , , , , , , , , ((uint16_t)0x0400U) , /* Pin 10 selected , , */

     ,

    ♯ define GPIO_PIN_11 , , , , , , , , , , , , , , , ((uint16_t)0x0800U) , /* Pin 11 selected , , */

     ,

    ♯ define GPIO_PIN_12 , , , , , , , , , , , , , , , ((uint16_t)0x1000U) , /* Pin 12 selected , , */

     ,

    ♯ define GPIO_PIN_13 , , , , , , , , , , , , , , , ((uint16_t)0x2000U) , /* Pin 13 selected , , */

     ,

    ♯ define GPIO_PIN_14 , , , , , , , , , , , , , , , ((uint16_t)0x4000U) , /* Pin 14 selected , , */

     ,

    ♯ define GPIO_PIN_15 , , , , , , , , , , , , , , , ((uint16_t)0x8000U) , /* Pin 15 selected , , */

     ,

    ♯ define GPIO_PIN_All , , , , , , , , , , , , , , ((uint16_t)0xFFFFU) , /* All pins selected */

    ♯ define GPIO_PIN_MASK , , , , , , , , , , , , , ((uint32_t)0x0000FFFFU) /* PIN mask for assert test */

     ,

    /**

     ,

     , * @}

     ,

     , */
    waclawek.jan
    Super User
    April 24, 2017
    Posted on April 24, 2017 at 12:38

    In Tab13, search for lines where in Comment the name starts with ARD_. Fig.33 may be more comprehensive.

    I am not going comment on the example code and 'libraries'.

    JW

    john doe
    Senior III
    April 24, 2017
    Posted on April 24, 2017 at 14:53

    Your code in your first post shows how to initialize a gpio pin.

    The relevant files are stm32f7xx_hal_gpio.h and stm32f7xx_hal_gpio.c

    Its just a connector on a board. there is no arduino gpio api in the HAL.

    benyBoy
    benyBoyAuthor
    Associate III
    April 24, 2017
    Posted on April 24, 2017 at 16:27

    thank for this, so I can use these as digital output if I initialise them as such ?

    PC02 = GPIO_PIN_2 = ARD_A2  ( arduino anlouge pin 2 )

    PC06 = GPIO_PIN_6 = ARD_D1 ( arduino digital pin 1 )

    PC07 = GPIO_PIN_7 = ARD_D0 ( arduino digital pin 0 )

    PC08 =  GPIO_PIN_8 = ARD_D5 ( arduino digital pin 5 )

    are there any other physical GPIO pins available as digital outputs on the STM32F769I-discovery ?

    what does PCx , PFx , PAx etc stand for ?

    benyBoy
    benyBoyAuthor
    Associate III
    April 24, 2017
    Posted on April 24, 2017 at 19:03

    I took a look at stm32f7xx_hal_gpio.c and came up with...

     HAL_GPIO_WritePin(GPIOA, 7,1); // GPIO_PIN_6 , ARD_D0 HIGH

      HAL_Delay(500);

      HAL_GPIO_WritePin(GPIOA, 7,0); // GPIO_PIN_6 , ARD_D0 LOW

    HAL_Delay(500);

      HAL_GPIO_WritePin(GPIOA, 7,1); // GPIO_PIN_6 , ARD_D0 HIGH

    HAL_Delay(500);

    Will try it now and report back here if it works.

    I noticed HAL_GPIO_TogglePin() but thought I'd try WritePin first.

    I'm not really sure what GPIOA is doing and having a guess 0 is off and 1 is on !