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

  • Could you be more specific about the micro and rtc you're talking about? Or should we guess?

  • Why? The RTC seems so complicated that you can't manage to write your own?

    Of course the RTC must feel technically challenging if you haven't even managed to figure out exactly what processor you have so you can check what documentation there is...

  • 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.

  • Nah. All that "study" and "learning" is so 20th century - just leap straight in with both feet and thrash around hoping that it'll all just fall into place.

    "design" - wassat??

  • "Don't any of you people Please read the manual?"

    I prefer the movie. But not the new remake.

  • OK, but i think this libraries must be implemented in this development software. Without this files is unusable. I think, must be other ways without this files or not? If not, i must download files from STM site and use it same as in older versions?

  • Why do you think that?

    "Without this files is unusable"

    Nonsense - a competent programmer could write it all from scratch from the Datasheet, These libraries are purely a convenience to save you the effort.

    " must download files from STM site "

    Exactly - they are provided as source; you can build them using whatever tools you like.

  • I don't have time for write over 10 000 rows for only initialize periphery. If i write all initialize functions for used periphery i have 160 years... Without support this libraries i go install older version where i can programming my own code 10 minutes after create new project and initialize all needed peripherials.
    This new solution is one step forward and two steps back :-(

  • This new solution is one step forward and two steps back :-(

    Why are you even looking at embedded? It is obvious that you are not capable of doing it.

  • 10000 lines and 160 years. I must be many times older than Merlin or Gandalf if we assume the code I have written have grown at only 62 lines/year. And I have programmed quite a number of chips without any manufacturer library to allow me to assign to lots and lots of structs and then call helper functions.

  • What do you mean, "new solution"?

    As far as the ST libraries are concerned, there is no difference - you get the source code from ST, and you include it in your project.

    Simples.

  • I know, that after version 4.12 was ST library diferent from definitions used in keil libraries. It could be in version 5 corrected, but ST libraries are not included in Keil as previously. I have worry, that downloaded ST library from their site will not be corrsepond as previously. In examples for LED "blinky" without RTOS is not included any STM library for driving GPIOs and initialize RCC. Because im saying "new soultion", there is used any other way for driving GPIOs. I think it is more difficult as before. I know, that project manager contains any features for initialize serial periphery. In this cause must contain all periphery as ST library. I mean, now are any periphery in project wizard and others periphery must be initialized from external ST library.

  • "after version 4.12 was ST library diferent from definitions used in keil libraries"

    And look at the trouble that caused!

    "It could be in version 5 corrected"

    I think it has been corrected - by keeping the silicon vendor's code separate from Keil's own stuff, there is no longer any risk of Keil's stuff getting clogged-up with out-of-date silicon vendor code.

    This seems like the most practical solution to me.

    Think about it: there are dozens (hundreds?) of silicon vendors, each with their own support libraries - it's impractical for a compiler vendor to try to keep up with all the different releases & revisions of all that 3rd-party stuff!

    Maybe this is the idea of the new "packs" approach - so that the silicon vendors can take ownership of the specific support for their particular product(s)...?

  • That was most certainly the case with the ST library!

    "or not organized in a manner conducive to source code management"

    Or both!