AnsweredAssumed Answered

Problem with GPIO in STM32F100 discovery card

Question asked by mich.lei on Jun 28, 2015
Latest reply on Jun 29, 2015 by Clive One
I have tried to test GPIO programming with CubeMX and the F100 discovery card. But outputs do not change.
I have a project directly from Cube, it has only IO which are used in Discovery card, other outputs don't work either.
I only added HAL_GPIO_WritePin(GPIOC, 0x09,1 ); in this project but other instructions do not work either.

The card works, because ready made demos work. But I would like to use projects from Cube for now.
#include "stm32l1xx_hal.h"
 
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
 
int main(void)
{
 
    HAL_Init();
 
    SystemClock_Config();
 
    MX_GPIO_Init();
 
    while (1)
    {
        /* USER CODE END WHILE */
        HAL_GPIO_WritePin(GPIOC, 0x09,1 );
    }
    /* USER CODE END 3 */
 
}
 
 
void SystemClock_Config(void)
{
 
    RCC_OscInitTypeDef RCC_OscInitStruct;
    RCC_ClkInitTypeDef RCC_ClkInitStruct;
 
    __PWR_CLK_ENABLE();
 
    __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
    RCC_OscInitStruct.HSICalibrationValue = 16;
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
    RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
    RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV3;
    HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
    HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1);
 
    __SYSCFG_CLK_ENABLE();
 
}
 
void MX_GPIO_Init(void)
{
 
    GPIO_InitTypeDef GPIO_InitStruct;
 
    /* GPIO Ports Clock Enable */
    __GPIOC_CLK_ENABLE();
    __GPIOH_CLK_ENABLE();
    __GPIOA_CLK_ENABLE();
    __GPIOB_CLK_ENABLE();
 
    /*Configure GPIO pin : PA0 */
    GPIO_InitStruct.Pin = GPIO_PIN_0;
    GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
    /*Configure GPIO pins : PC8 PC9 */
    GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
}
 
/* USER CODE BEGIN 4 */
 
/* USER CODE END 4 */
 
#ifdef USE_FULL_ASSERT
 
 
void assert_failed(uint8_t* file, uint32_t line)
{
}
 
#endif

Outcomes