cancel
Showing results for 
Search instead for 
Did you mean: 

Distribute Pll in STM32F407 board.

rohitkumarkv07
Associate III

I have developed two functions that is Mcu_Init and Mcu_Initclock in Mcu development for stm32F407 board.

Similarly I want to develop Distribute Pll function for this but I am unable to do that.

Could you help me in this ?

Pfa of my code below.

#include "Mcu.h"
#include "Mcu_Config.h"
#include "Mcu_Internal.h"
#include "Mcu_RegTypes.h"

Mcu_ConfigType* Mcu_pConfigPtr = NULL_PTR;

static FUNC(void, MCU_CODE) Mcu_Pwr_Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_Flash_Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_AllPeriphralReset(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_AHB1Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_AHB2Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_AHB3Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_APB1Init(VAR( void, AUTOMATIC));
static FUNC(void, MCU_CODE) Mcu_APB2Init(VAR( void, AUTOMATIC));

static FUNC(void, MCU_CODE) Mcu_Pwr_Init(VAR( void, AUTOMATIC))
{
	PwrConfigType* LpPwrConfigPtr;
	PWR_RegTypedef* LpPWR_Reg = PWR_REGADDRESS;

	LpPwrConfigPtr = Mcu_pConfigPtr->PWRConfgSet;
#if(MCU_VOS_SCALE_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.VOS;
#endif
#if(MCU_FPDS_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.FPDS;
#endif
#if(MCU_DBP_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.DBP;
#endif
#if(MCU_PLS_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.PLS;
#endif
#if(MCU_PVDE_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.PVDE;
#endif
#if(MCU_PDDS_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.PDDS;
#endif
#if(MCU_LPDS_USED == STD_ON)
	LpPWR_Reg->CR |= LpPwrConfigPtr->PwrCRConfgVal.LPDS;
#endif

#if(MCU_BRE_USED == STD_ON)
	LpPWR_Reg->CSR |= LpPwrConfigPtr->PwrCSRConfgVal.BRE;
#endif
#if(MCU_EWUP_USED == STD_ON)
	LpPWR_Reg->CSR |= LpPwrConfigPtr->PwrCSRConfgVal.EWUP;
#endif

}
static FUNC(void, MCU_CODE) Mcu_Flash_Init(VAR( void, AUTOMATIC))
{
	FLASHConfigType* LpFlashconfigPtr;
	FLASH_RegTypedef* LpFLASH_Reg = FLASH_REGADDRESS;
	LpFlashconfigPtr = Mcu_pConfigPtr->FlashConfgSet;
#if(MCU_DCRST_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.DCRST;
#endif
#if(MCU_ICRST_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.ICRST;
#endif
#if(MCU_LATENCY_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.LATENCY;
#endif


#if(MCU_DCEN_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.DCEN;
#endif
#if(MCU_ICEN_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.ICEN;
#endif
#if(MCU_PRFTEN_USED == STD_ON)
	LpFLASH_Reg->ACR |= LpFlashconfigPtr->FLASHACRConfgVal.PRFTEN;
#endif

}
static FUNC(void, MCU_CODE) Mcu_AllPeriphralReset(VAR( void, AUTOMATIC))
{
	RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	/*Reset the MCU Peripherals */
	LpRCC_Reg->AHB1RSTR =(uint32)(RCC_AHB1RSTR_RESET);
	LpRCC_Reg->AHB1RSTR =(uint32)(0x00000000);
	LpRCC_Reg->AHB2RSTR =(uint32)(RCC_AHB2RSTR_RESET);
	LpRCC_Reg->AHB2RSTR =(uint32)(0x00000000);
	LpRCC_Reg->AHB3RSTR =(uint32)(RCC_AHB3RSTR_RESET);
	LpRCC_Reg->AHB3RSTR =(uint32)(0x00000000);
	LpRCC_Reg->APB1RSTR =(uint32)(RCC_APB1RSTR_RESET);
	LpRCC_Reg->APB1RSTR =(uint32)(0x00000000);
	LpRCC_Reg->APB2RSTR =(uint32)(RCC_APB2RSTR_RESET);
	LpRCC_Reg->APB2RSTR =(uint32)(0x00000000);
	/*Reset the MCU Peripherals */
}
static FUNC(void, MCU_CODE) Mcu_AHB1Init(VAR( void, AUTOMATIC))
{
	McuClockConfigType* LpMcuClockConfigPtr;

	RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;

	/*McuAHB1ENRConfgVal*/
#ifdef MCU_USB_OTG_USED
#if(OTGHSULPIEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.OTGHSULPIEN;
#endif
#if(OTGHSEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.OTGHSEN;
#endif
#endif

#ifdef MCU_ETHMAC_USED
#if(ETHMACPTPEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.ETHMACPTPEN;
#endif
#if(ETHMACRXEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.ETHMACRXEN;
#endif
#if(ETHMACTXEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.ETHMACTXEN;
#endif
#if(ETHMACEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.ETHMACEN;
#endif
#endif

#ifdef MCU_DMA_USED
#if(DMA2EN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.DMA2EN;
#endif
#if(DMA1EN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.DMA1EN;
#endif
#endif

#ifdef MCU_CCM_DATA_RAM_USED
#if(CCMDATARAMEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.CCMDATARAMEN;
#endif
#endif

#ifdef MCU_BKP_SRAM_USED
#if(BKPSRAMEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.BKPSRAMEN;
#endif
#endif

#ifdef MCU_CRC_USED
#if(CRCEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.CRCEN;
#endif
#endif

#ifdef MCU_GPIO_USED
#if(GPIOIEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOIEN;
#endif
#if(GPIOHEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOHEN;
#endif
#if(GPIOGEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOGEN;
#endif
#if(GPIOFEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOFEN;
#endif
#if(GPIOEEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOEEN;
#endif

#if(GPIODEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIODEN;
#endif

#if(GPIOCEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOCEN;
#endif
#if(GPIOBEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOBEN;
#endif
#if(GPIOAEN_USED == STD_ON)
	LpRCC_Reg->AHB1ENR |= LpMcuClockConfigPtr->McuAHB1ENRConfgVal.GPIOAEN;
#endif
#endif
}
static FUNC(void, MCU_CODE) Mcu_AHB2Init(VAR( void, AUTOMATIC))
{
	//McuClockConfigType* LpMcuClockConfigPtr;

	//RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	//LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;

    /*McuAHB2ENRConfgVal*/
#if(OTGFSEN_USED == STD_ON)
	LpRCC_Reg->AHB2ENR |= LpMcuClockConfigPtr->McuAHB2ENRConfgVal.OTGFSEN;
#endif
#if(RNGEN_USED == STD_ON)
	LpRCC_Reg->AHB2ENR |= LpMcuClockConfigPtr->McuAHB2ENRConfgVal.RNGEN;
#endif
#if(HASHEN_USED == STD_ON)
	LpRCC_Reg->AHB2ENR |= LpMcuClockConfigPtr->McuAHB2ENRConfgVal.HASHEN;
#endif
#if(CRYPEN_USED == STD_ON)
	LpRCC_Reg->AHB2ENR |= LpMcuClockConfigPtr->McuAHB2ENRConfgVal.CRYPEN;
#endif
#if(DCMIEN_USED == STD_ON)
	LpRCC_Reg->AHB2ENR |= LpMcuClockConfigPtr->McuAHB2ENRConfgVal.DCMIEN;
#endif


}
static FUNC(void, MCU_CODE) Mcu_AHB3Init(VAR( void, AUTOMATIC))
{
	//McuClockConfigType* LpMcuClockConfigPtr;

	//RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	//LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;

	/*McuAHB3ENRConfgVal*/
#if(DCMIEN_USED == STD_ON)
	LpRCC_Reg->AHB3ENR |= LpMcuClockConfigPtr->McuAHB3ENRConfgVal.FSMCEN;
#endif
}
static FUNC(void, MCU_CODE) Mcu_APB1Init(VAR( void, AUTOMATIC))
{
	McuClockConfigType* LpMcuClockConfigPtr;

	RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;


	/*McuAPB1ENRConfgVal*/
#ifdef MCU_DAC_USED
#if(DACEN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.DACEN;
#endif
#endif
#ifdef MCU_PWR_USED
#if(PWREN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.PWREN;
#endif
#endif
#ifdef MCU_CAN_USED
#if(CAN2EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.CAN2EN;
#endif
#if(CAN1EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.CAN1EN;
#endif
#endif

#ifdef MCU_I2C_USED
#if(I2C3EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.I2C3EN;
#endif
#if(I2C2EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.I2C2EN;
#endif
#if(I2C1EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.I2C1EN;
#endif
#endif
#ifdef MCU_UART_USED
#if(UART5EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.UART5EN;
#endif
#if(UART4EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.UART4EN;
#endif
#endif
#ifdef MCU_USART_USED
#if(USART3EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.USART3EN;
#endif
#if(USART2EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.USART2EN;
#endif
#endif
#ifdef MCU_SPI_USED
#if(SPI3EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.SPI3EN;
#endif
#if(SPI2EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.SPI2EN;
#endif
#endif
#if(WWDGEN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.WWDGEN;
#endif
#ifdef MCU_TIM_USED
#if(TIM14EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.UART4EN;
#endif
#if(TIM13EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM13EN;
#endif
#if(TIM12EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM12EN;
#endif
#if(TIM7EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM7EN;
#endif
#if(TIM6EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM6EN;
#endif
#if(TIM5EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM5EN;
#endif
#if(TIM4EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM4EN;
#endif
#if(TIM3EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM3EN;
#endif
#if(TIM2EN_USED == STD_ON)
	LpRCC_Reg->APB1ENR |= LpMcuClockConfigPtr->McuAPB1ENRConfgVal.TIM2EN;
#endif
#endif

}
static FUNC(void, MCU_CODE) Mcu_APB2Init(VAR( void, AUTOMATIC))
{
	//McuClockConfigType* LpMcuClockConfigPtr;

	//RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;

	//LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;


	/*McuAPB2ENRConfgVal*/
#ifdef MCU_TIM_USED
#if(TIM11EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.TIM11EN;
#endif
#if(TIM10EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.TIM10EN;
#endif
#if(TIM9EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.TIM9EN;
#endif
#endif
#if(SYSCFGEN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.SYSCFGEN;
#endif
#if(SPI1EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.SPI1EN;
#endif
#if(SPI1EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.SDIOEN;
#endif
#ifdef MCU_ADC_USED
#if(ADC3EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.ADC3EN;
#endif
#if(ADC3EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.ADC2EN;
#endif
#if(ADC3EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.ADC1EN;
#endif
#endif
#ifdef MCU_USART_USED
#if(USART6EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.USART6EN;
#endif
#if(USART5EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.USART1EN;
#endif
#endif
#ifdef MCU_TIM_USED
#if(TIM8EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.TIM8EN;
#endif
#if(TIM1EN_USED == STD_ON)
	LpRCC_Reg->APB2ENR |= LpMcuClockConfigPtr->McuAPB2ENRConfgVal.TIM1EN;
#endif
#endif
}

FUNC(void, MCU_CODE) Mcu_Init( Mcu_ConfigType* pConfigPtr)
{
	Mcu_pConfigPtr = pConfigPtr;

	Mcu_AllPeriphralReset();
	Mcu_Pwr_Init();
	Mcu_Flash_Init();
	Mcu_AHB1Init();
	Mcu_AHB2Init();
	Mcu_AHB3Init();
	Mcu_APB1Init();
	Mcu_APB2Init();
}

FUNC( Std_ReturnType, MCU_CODE) Mcu_InitClock( VAR( uint8, AUTOMATIC) ClockSetting)
{
	McuClockConfigType* LpMcuClockConfigPtr;
	RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;
	LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;



#if(MCU_PLLI2S_USED == STD_ON)
    LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.PLLI2SON;
#endif
#if(MCU_PLL_USED == STD_ON)
    LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.PLLON;
#endif
#if(MCU_CSS_USED == STD_ON)
	LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.CSSON;
#endif

#if(MCU_HSEBYP_USED == STD_ON)
	LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.HSEBYP;
#endif

	
#if(MCU_HSE_USED == STD_ON)
    LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.HSEON;
#endif
    while(!(LpRCC_Reg->CR &(1<<17)));

#if(MCU_HSITRIM_USED == STD_ON)
    LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.HSITRIM;
#endif

#if(MCU_HSI_USED == STD_ON)
	LpRCC_Reg->CR |= LpMcuClockConfigPtr->McuCRConfgVal.HSION;
#endif


#if(MCU_PLLM_USED == STD_ON)
	LpRCC_Reg->PLLCFGR |= LpMcuClockConfigPtr->McuPLLCFGRConfgVal.PLLM;
#endif
#if(MCU_PLLN_USED == STD_ON)
	LpRCC_Reg->PLLCFGR |= LpMcuClockConfigPtr->McuPLLCFGRConfgVal.PLLN;
#endif
#if(MCU_PLLP_USED == STD_ON)
	LpRCC_Reg->PLLCFGR |= LpMcuClockConfigPtr->McuPLLCFGRConfgVal.PLLP;
#endif
#if(MCU_PLLSRC_HSE_USED == STD_ON)
	LpRCC_Reg->PLLCFGR |= LpMcuClockConfigPtr->McuPLLCFGRConfgVal.PLLSRC;
#endif
#if(MCU_PLLQ_USED == STD_ON)
	LpRCC_Reg->PLLCFGR |= LpMcuClockConfigPtr->McuPLLCFGRConfgVal.PLLQ;
#endif


#if(MCU_PRE2_AHB_2_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.HPRE;
#endif
#if(MCU_PRE1_AHB_4_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.PPRE1;
#endif
#if(MCU_HRPE_SYSCLK_1_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.PPRE2;
#endif
#if(MCU_SW_PLL_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.SW;
#endif
#if(MCU_MCO2_SYSCLK_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.MCO2;
#endif
#if(MCU_MCO2PRE_2_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.MCO2PRE;
#endif
#if(MCU_MCO1PRE_2_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.MCO1PRE;
#endif
#if(MCU_I2SSRC_PLL_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.I2SSRC;
#endif
#if(MCU_MCO1_HSE_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.MCO1;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CFGR |= LpMcuClockConfigPtr->McuCFGRConfgVal.RTCPRE;
#endif


#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.PLLI2SRDYIE;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.PLLRDYIE;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.HSERDYIE;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.HSIRDYIE;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.LSERDYIE;
#endif
#if(MCU_RTC_PREHSE_1_USED == STD_ON)
	LpRCC_Reg->CIR|=LpMcuClockConfigPtr->McuCIRConfgVal.LSIRDYIE;
#endif


#if 0
	LpRCC_Reg->BDCR = LpMcuClockConfigPtr->McuBDCRConfgVal.BDRST;
	LpRCC_Reg->BDCR = LpMcuClockConfigPtr->McuBDCRConfgVal.RTCEN;
	LpRCC_Reg->BDCR = LpMcuClockConfigPtr->McuBDCRConfgVal.RTCSEL;
	LpRCC_Reg->BDCR = LpMcuClockConfigPtr->McuBDCRConfgVal.LSEBYP;
	LpRCC_Reg->BDCR = LpMcuClockConfigPtr->McuBDCRConfgVal.LSEON;
	LpRCC_Reg->CSR = LpMcuClockConfigPtr->McuCSRConfgVal.LSION;
	LpRCC_Reg->SSCGR = LpMcuClockConfigPtr->McuSSCGRConfgVal.SSCGEN;
	LpRCC_Reg->SSCGR = LpMcuClockConfigPtr->McuSSCGRConfgVal.SPREADSEL;
	LpRCC_Reg->SSCGR = LpMcuClockConfigPtr->McuSSCGRConfgVal.INCSTEP;
	LpRCC_Reg->SSCGR = LpMcuClockConfigPtr->McuSSCGRConfgVal.MODPER;
	LpRCC_Reg->PLLI2SCFGR = LpMcuClockConfigPtr->McuPLLI2SCFGRConfgVal.PLLI2SR;
	LpRCC_Reg->PLLI2SCFGR = LpMcuClockConfigPtr->McuPLLI2SCFGRConfgVal.PLLI2SN;
#endif
	return E_OK;
}

/*FUNC( Std_ReturnType, MCU_CODE) Mcu_DistributePLL( VAR( uint8, AUTOMATIC) ClockSetting)

{

}


FUNC( Std_ReturnType, MCU_CODE) Mcu_GstPLLStatus( VAR( uint8, AUTOMATIC) ClockSetting)

{
	McuClockConfigType* LpMcuClockConfigPtr;
	RCC_RegTypedef* LpRCC_Reg = RCC_REGADDRESS;
	LpMcuClockConfigPtr = Mcu_pConfigPtr->McuClockConfgSet;

	VAR(Mcu_ResetType, AUTOMATIC) eResetReason;
    eResetReason = (uint32)LpRCC_Reg->CSR;

    return (Mcu_ResetType)eResetReason;

}*/




  

1 REPLY 1
rohitkumarkv07
Associate III

Can you help me with this query.