sdram test
This commit is contained in:
@ -331,6 +331,7 @@ void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
|
||||
/**LTDC GPIO Configuration
|
||||
PF10 ------> LTDC_DE
|
||||
PC0 ------> LTDC_R5
|
||||
PA1 ------> LTDC_R2
|
||||
PA3 ------> LTDC_B5
|
||||
PA4 ------> LTDC_VSYNC
|
||||
PA5 ------> LTDC_R4
|
||||
@ -349,6 +350,7 @@ void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
|
||||
PA10 ------> LTDC_B4
|
||||
PA15 ------> LTDC_B6
|
||||
PD2 ------> LTDC_B7
|
||||
PD6 ------> LTDC_B2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
@ -364,8 +366,8 @@ void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
|
||||
|GPIO_PIN_15;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|
||||
|GPIO_PIN_6|GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
@ -421,6 +423,13 @@ void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* LTDC interrupt Init */
|
||||
HAL_NVIC_SetPriority(LTDC_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(LTDC_IRQn);
|
||||
@ -451,6 +460,7 @@ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
|
||||
/**LTDC GPIO Configuration
|
||||
PF10 ------> LTDC_DE
|
||||
PC0 ------> LTDC_R5
|
||||
PA1 ------> LTDC_R2
|
||||
PA3 ------> LTDC_B5
|
||||
PA4 ------> LTDC_VSYNC
|
||||
PA5 ------> LTDC_R4
|
||||
@ -469,21 +479,22 @@ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
|
||||
PA10 ------> LTDC_B4
|
||||
PA15 ------> LTDC_B6
|
||||
PD2 ------> LTDC_B7
|
||||
PD6 ------> LTDC_B2
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_10);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_7
|
||||
|GPIO_PIN_9);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
|
||||
|GPIO_PIN_8|GPIO_PIN_10|GPIO_PIN_15);
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|
||||
|GPIO_PIN_6|GPIO_PIN_8|GPIO_PIN_10|GPIO_PIN_15);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_11
|
||||
|GPIO_PIN_15);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_7);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2|GPIO_PIN_6);
|
||||
|
||||
/* LTDC interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(LTDC_IRQn);
|
||||
@ -494,94 +505,6 @@ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hsd->Instance==SDMMC2)
|
||||
{
|
||||
/* USER CODE BEGIN SDMMC2_MspInit 0 */
|
||||
|
||||
/* USER CODE END SDMMC2_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SDMMC2_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
/**SDMMC2 GPIO Configuration
|
||||
PC1 ------> SDMMC2_CK
|
||||
PB14 ------> SDMMC2_D0
|
||||
PD7 ------> SDMMC2_CMD
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_SDMMC2;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_14;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_SDMMC2;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SDMMC2_MspInit 1 */
|
||||
|
||||
/* USER CODE END SDMMC2_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
if(hsd->Instance==SDMMC2)
|
||||
{
|
||||
/* USER CODE BEGIN SDMMC2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SDMMC2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SDMMC2_CLK_DISABLE();
|
||||
|
||||
/**SDMMC2 GPIO Configuration
|
||||
PC1 ------> SDMMC2_CK
|
||||
PB14 ------> SDMMC2_D0
|
||||
PD7 ------> SDMMC2_CMD
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_7);
|
||||
|
||||
/* USER CODE BEGIN SDMMC2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SDMMC2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
@ -807,6 +730,23 @@ static void HAL_FMC_MspInit(void){
|
||||
return;
|
||||
}
|
||||
FMC_Initialized = 1;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_FMC;
|
||||
PeriphClkInitStruct.PLL2.PLL2M = 2;
|
||||
PeriphClkInitStruct.PLL2.PLL2N = 70;
|
||||
PeriphClkInitStruct.PLL2.PLL2P = 2;
|
||||
PeriphClkInitStruct.PLL2.PLL2Q = 4;
|
||||
PeriphClkInitStruct.PLL2.PLL2R = 2;
|
||||
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
|
||||
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
|
||||
PeriphClkInitStruct.FmcClockSelection = RCC_FMCCLKSOURCE_PLL2;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_FMC_CLK_ENABLE();
|
||||
|
||||
Reference in New Issue
Block a user