STM32F10xxx 勘误表 有相关说明 2.1 PD0 and PD1 use in output mode Description The use of PD0 and PD1 in output mode is limited as, in this mode, PD0 and PD1 used at 2 MHz and 10 MHz. Workaround When the output mode is required, PD0 and PD1 must be used at 50 MHz.
void NVIC_Configuration(void) { #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #endif
As you have mentioned, the IO remap of PD0 / PD1 on OSCIN / OSCOUT is not working on The early Silicon revision A, In fact The remapping of PD0 / PD1 was done but the configuration of PD0 and PD1 is forced to output push-pull and their level is driven to 0 by the package options.
The fix of this limitation was already identified and resolved in the official Silicon revision. Please contact ST Sales offices for more details about the availability for your Region.
/******************************************************************************* * Function Name : RCC_Configuration * Description : * Input : None * Output : None * Return : None *******************************************************************************/ void RCC_Configuration(void) { RCC_DeInit(); /* RCC system reset(for debug purpose) */ FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); /* Enable Prefetch Buffer */ FLASH_SetLatency(FLASH_Latency_2); /* Flash 2 wait state */ RCC_HCLKConfig(RCC_SYSCLK_Div1); /* HCLK = SYSCLK */ RCC_PCLK2Config(RCC_HCLK_Div1); /* PCLK2 = HCLK */ RCC_PCLK1Config(RCC_HCLK_Div2); /* PCLK1 = HCLK/2 */ RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_12); /* PLLCLK = 8MHz /2 * 12 = 48 MHz */ RCC_PLLCmd(ENABLE); /* Enable PLL */ while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {} /* Wait till PLL is ready */ RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); /* Select PLL as system clock source */ while(RCC_GetSYSCLKSource() != 0x08) {} /* Wait till PLL is used as system clock source */
RCC_GetClocksFreq(&RCC_ClockFreq); // This function fills a RCC_ClocksTypeDef structure with the current frequencies of different on chip clocks (for debug purpose) /* The RCC_ClockFreq members should be as following: RCC_ClockFreq.SYSCLK_Frequency = 48000000 RCC_ClockFreq.HCLK_Frequency = 48000000 RCC_ClockFreq.PCLK1_Frequency = 24000000 RCC_ClockFreq.PCLK2_Frequency = 48000000 RCC_ClockFreq.ADCCLK_Frequency = 24000000 */ }
/******************************************************************************* * Function Name : NVIC_Configuration * Description : Configures Vector Table base location. * Input : None * Output : None * Return : None *******************************************************************************/ void NVIC_Configuration(void) { #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #endif }
/******************************************************************************* * Function Name : main * Description : * Input : None * Output : None * Return : None *******************************************************************************/ int main(void) { GPIO_InitTypeDef GPIO_InitStructure;