This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using RTC in new MDK uVision5

Hello,
I'm trying use new uVision5 and i don't know where is pariphery library for RTC and how it use. Can anyone help me with this?

Thank You
Jan

Parents Reply Children
  • I have STM32F103RBT6. I'm searching library, where is structure for initialize RTC periphery. In this .c and .h are declared functions for set RTC, read RTC and others functions for work with RTC. Same to GPIO i can't search .c and .h files, where is structture for initialize concrete pins as (IN, OUT, AFIO, speed, etc.). This method was used in older versions MDK-ARM uVision 4.xx.
    This files have names for example: stm32f10x_rtc.h + stm32f10x_rtc.c, stm32f10x_gpio.h + stm32f10x_gpio.c.

    I don't have any code because i don't know how initialize each periphery without these files. Most important files which i can't search is for RCC for set internal clock for AHB, APB1, APB2. This "periphery" i can set in older versions that:

    void RCC_Configuration(void)
    {
    ErrorStatus HSEStartUpStatus;
      RCC_DeInit();
      RCC_HSEConfig(RCC_HSE_ON);                                                                    // Enable HSE
      HSEStartUpStatus = RCC_WaitForHSEStartUp();                                   // Wait till HSE is ready
      if(HSEStartUpStatus == SUCCESS)
        {
         FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);              // Enable Prefetch Buffer
         FLASH_SetLatency(FLASH_Latency_2);                                                 // Flash 2 wait state
         RCC_HCLKConfig(RCC_SYSCLK_Div1);                                                   // HCLK = SYSCLK 72MHz
         RCC_PCLK2Config(RCC_HCLK_Div1);                                                    // PCLK2 = HCLK 72MHz
         RCC_PCLK1Config(RCC_HCLK_Div2);                                                    // PCLK1 = HCLK/2 36MHz
         RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);               // PLLCLK = 8MHz * 9 = 72 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
        }
      // Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks
      RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
             | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG
             | RCC_APB2Periph_AFIO, ENABLE);
    }
    

    For GPIOs that:

    void GPIO_Configuration(void)
    {
    
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
      GPIO_Init(GPIOA, &GPIO_InitStructure);
    }
    

    If i need set RTC, i can use function of stm32f10x_rtc.h declared in stm32f10x_rtc.c that:

    RTC_SetCounter(1336942091);
    


    If i need set one GPIO as '1' i use:

    GPIO_SetBits(GPIOA, GPIO_Pin_3);
    


    This all functions i using in older versions and now i version 5 i don't know where are .c and .h files. Can anyone explain me how it works in version 5? How set RTC or any GPIO pin and initialize periphery?

    Thank you
    Jan

  • The code you show is from the ST Standard Peripheral Library. It is from ST, not Keil - it has nothing specifically to do with Keil or uVision or MDK.