Plese Ignore this Post

Just putting this here for a report

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
  ******************************************************************************
  * @file    main.c
  * @author  Ac6
  * @version V1.0
  * @date    01-December-2013
  * @brief   Default main function.
  ******************************************************************************
*/
#include "stm32f7xx.h"
#include "stm32746g_discovery.h"

static void SystemClock_Config(void);
static void CPU_CACHE_Enable(void);

static GPIO_InitTypeDef  GPIO_InitStruct;

static void LED_SETUP(void)
	{
	      __HAL_RCC_GPIOI_CLK_ENABLE();
	      //First Enable the GPIO Port I Clock
	      //GREEN LED PORT I PIN 1
	      GPIO_InitStruct.Pin = GPIO_PIN_1;
	      GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
	      GPIO_InitStruct.Pull = GPIO_PULLUP;
	      GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
	      HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
	}

static void LED_SETUP1(void)
	{
	      __HAL_RCC_GPIOI_CLK_ENABLE();
	      //First Enable the GPIO Port I Clock
	      //GREEN LED PORT I PIN 3
	      GPIO_InitStruct.Pin = GPIO_PIN_3;
	      GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
	      GPIO_InitStruct.Pull = GPIO_PULLUP;
	      GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
	      HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
	}

int main(void)
{
	SystemClock_Config();
	CPU_CACHE_Enable();
	HAL_Init();

	LED_SETUP();
	LED_SETUP1();

	for(;;)
	{
		HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, SET);
		HAL_Delay(1000);
		HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, RESET);
		HAL_Delay(1000);
		HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, SET);
		HAL_Delay(1000);
		HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, RESET);
		HAL_Delay(1000);
	}
}

/**
* @brief  System Clock Configuration
*         The system Clock is configured as follow :
*            System Clock source            = PLL (HSE)
*            SYSCLK(Hz)                     = 216000000
*            HCLK(Hz)                       = 216000000
*            AHB Prescaler                  = 1
*            APB1 Prescaler                 = 4
*            APB2 Prescaler                 = 2
*            HSE Frequency(Hz)              = 25000000
*            PLL_M                          = 25
*            PLL_N                          = 432
*            PLL_P                          = 2
*            PLL_Q                          = 9
*            VDD(V)                         = 3.3
*            Main regulator output voltage  = Scale1 mode
*            Flash Latency(WS)              = 7
* @param  None
* @retval None
*/
static void SystemClock_Config(void)
{
  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_OscInitTypeDef RCC_OscInitStruct;

  /* Enable HSE Oscillator and activate PLL with HSE as source */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 25;
  RCC_OscInitStruct.PLL.PLLN = 432;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = 9;
  HAL_RCC_OscConfig(&RCC_OscInitStruct);

  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
  clocks dividers */
  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7);
}

/**
* @brief  CPU L1-Cache enable.
* @param  None
* @retval None
*/
static void CPU_CACHE_Enable(void)
{
  /* Enable I-Cache */
  SCB_EnableICache();

  /* Enable D-Cache */
  SCB_EnableDCache();
}
Topic archived. No new replies allowed.