/** * @brief Initializes LEDs, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the SRAM */ BSP_SRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(320, 240); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); /* reconfigure FSMC NE3 pin */ GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Pull = GPIO_PULLUP; GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; GPIO_InitStructure.Alternate = GPIO_AF12_FSMC; GPIO_InitStructure.Pin = GPIO_PIN_10; HAL_GPIO_Init(GPIOG, &GPIO_InitStructure); }
/** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable CS GPIO clock and Configure GPIO PIN for Gyroscope Chip select */ __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStructure.Pin = GPIO_PIN_1; GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Speed = GPIO_SPEED_MEDIUM; HAL_GPIO_Init(GPIOC, &GPIO_InitStructure); /* Deselect : Chip Select high */ HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, GPIO_PIN_SET); /* Configure LED3 and LED4 */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the SDRAM */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); }
static void init_system_clock(void) { (DBGMCU)->APB1FZ = 0x7E01BFF; (DBGMCU)->APB2FZ = 0x70003; HAL_StatusTypeDef res; RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; __HAL_RCC_PWR_CLK_ENABLE(); __HAL_RCC_CRC_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; 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; res = HAL_RCC_OscConfig(&RCC_OscInitStruct); ASSERT_CRIT(res == HAL_OK); res = HAL_PWREx_EnableOverDrive(); ASSERT_CRIT(res == HAL_OK); RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | 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; res = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7); ASSERT_CRIT(res == HAL_OK); PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC | RCC_PERIPHCLK_SAI2; PeriphClkInitStruct.PLLSAI.PLLSAIN = 100; PeriphClkInitStruct.PLLSAI.PLLSAIR = 2; PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2; PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV2; PeriphClkInitStruct.PLLSAIDivQ = 1; PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2; PeriphClkInitStruct.Sai2ClockSelection = RCC_SAI2CLKSOURCE_PLLSAI; res = HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); ASSERT_CRIT(res == HAL_OK); HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); }
/** * @brief Initializes the STM32091C-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM32091C-EVAL's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Enable the CRC Module */ __HAL_RCC_CRC_CLK_ENABLE(); }
/** * @brief Initializes the STM32L496G-Discovery's LCD and LEDs resources. * @param None * @retval None */ void BSP_GUI_init(void) { /*## LCD Configuration ##################################################*/ /* Enable the CRC Module */ __HAL_RCC_CRC_CLK_ENABLE(); /* Init the STemWin GUI Library */ GUI_Init(); GUI_Initialized = 1; /* Activate the use of memory device feature */ WM_SetCreateFlags(WM_CF_MEMDEV); }
/** * @brief Initializes the STM324xG-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable the CRC Module */ __HAL_RCC_CRC_CLK_ENABLE(); }
void board_unique_crcid_init (unsigned long seed, int flags) { int i; __HAL_RCC_CRC_CLK_ENABLE(); // turn on CRC module's clocks // Configure the CRC peripheral CrcHandle.Instance = CRC; i = HAL_CRC_Init (&CrcHandle); if (i != HAL_OK) { while (1); // Initialization Error - hang for debugger } }
/** * @brief Initializes LEDs, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(320, 240); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); }
/** * @brief Initializes the STM32F429I-DISCO's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM32F429I-DISCO's LEDs */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initializes the SDRAM device */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable the CRC Module */ __HAL_RCC_CRC_CLK_ENABLE(); }
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc) { if(hcrc->Instance==CRC) { /* USER CODE BEGIN CRC_MspInit 0 */ /* USER CODE END CRC_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_CRC_CLK_ENABLE(); /* USER CODE BEGIN CRC_MspInit 1 */ /* USER CODE END CRC_MspInit 1 */ } }
/** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { /* Initialize the NOR */ // BSP_QSPI_Init(); // BSP_QSPI_MemoryMappedMode(); /* Initialize the SDRAM */ // BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(420, 272); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); }
/** System Clock Configuration */ 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_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; // RCC_OscInitStruct.OscillatorType |= RCC_OSCILLATORTYPE_LSI; // uncomment when LSI clock is used for RTC // RCC_OscInitStruct.LSIState = RCC_LSI_ON; // uncomment when LSI Clock is used for RTC RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 8; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 7; HAL_RCC_OscConfig(&RCC_OscInitStruct); RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|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_5); #ifdef USE_STM32F4_RTC RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV8; // Comment this line if you want to use LSI clock // PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; // Remove comment if you want to use LSI clock HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); #endif /* USE_STM32F4_RTC */ #ifdef USE_STM32F4_TSC /* Enable the CRC Module */ __HAL_RCC_CRC_CLK_ENABLE(); #endif }
/** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { BSP_IO_Init(); /* Initialize the NOR */ BSP_NOR_Init(); /* Initialize the SDRAM */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(640, 480); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); }
/** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the SDRAM */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(640, 480); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); }
/** * @brief CRC MSP Initialization * This function configures the hardware resources used in this example: * - Peripheral's clock enable * @param hcrc: CRC handle pointer * @retval None */ void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) { /* CRC Peripheral clock enable */ __HAL_RCC_CRC_CLK_ENABLE(); }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Initialize LCD and LEDs */ BSP_Config(); /***********************************************************/ /* Compute the prescaler value to have TIM3 counter clock equal to 10 KHz */ uwPrescalerValue = (uint32_t) ((SystemCoreClock /2) / 10000) - 1; /* Set TIMx instance */ TimHandle.Instance = TIM3; /* Initialize TIM3 peripheral as follows: + Period = 500 - 1 + Prescaler = ((SystemCoreClock/2)/10000) - 1 + ClockDivision = 0 + Counter direction = Up */ TimHandle.Init.Period = 500 - 1; TimHandle.Init.Prescaler = uwPrescalerValue; TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; if(HAL_TIM_Base_Init(&TimHandle) != HAL_OK) { while(1) { } } /*##-2- Start the TIM Base generation in interrupt mode ####################*/ /* Start Channel1 */ if(HAL_TIM_Base_Start_IT(&TimHandle) != HAL_OK) { while(1) { } } /***********************************************************/ /* Init the STemWin GUI Library */ BSP_SDRAM_Init(); /* Initializes the SDRAM device */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable the CRC Module */ GUI_Init(); GUI_SetFont(&GUI_Font32_ASCII); GUI_DispStringAt("Starting...", 0, 0); /* Initialize LCD and LEDs */ GUI_DispStringAt("Initializing lcd...", 0, 32); /* Activate the use of memory device feature */ WM_SetCreateFlags(WM_CF_MEMDEV); MainTask(); /* Infinite loop */ for(;;); }