cancel
Showing results for 
Search instead for 
Did you mean: 

STM8 UART

Pankaj3
Associate II

I am frustated from last month can anyone plz help me out

I am getting error if I am adding UART file in our program.

I have taken UART example provided in STM8S_StdPeriph_Examples and added those files in STM8S_StdPeriph_Template but without adding UART file everything is working fine but if I add UART file I am getting this error

#error clnk Debug\led_on_off.lkf:1 symbol _CLK_GetClockFreq not defined (Debug\stm8s_uart1.o )
compiler : cosmic

IDE: STVD 

controller: STM8AF5288

4 REPLIES 4

So likely has a dependency on source file you're failing to provide in the project build.

Grep or find-in-file the entire library source to isolate where the body of that function resides.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pankaj3
Associate II

Is there any libraries which particularly made for cosmic compiler only
why am I asking this because there are lot of compiler option in this, that's why it's not working properly as I am new up in this. Please provide a solution to this.

Is there any possibility that their must me a problem of version of STVD IDE. Please provide me the latest in which STM8AF5288 will work. I am working on version 4.3.12 STVD

 

Another problem is my normal program is not working. code is getting compiled but after entering in debug mode it's stopping on line number 36 as show in image. It is not going beyond line number 36

Pankaj3_0-1704975156846.png   

 

 

 

Pankaj3
Associate II

@Tesla DeLorean please reply

Likely need stm8??_clk.c file in project. Check for a file specific to your STM8 model.

en.stsw-stm8069\STM8S_StdPeriph_Lib\Libraries\STM8S_StdPeriph_Driver\src\stm8s_clk.c

/**
  * @brief  This function returns the frequencies of different on chip clocks.
  * @PAram  None
  * @retval the master clock frequency
  */
uint32_t CLK_GetClockFreq(void)
{
  uint32_t clockfrequency = 0;
  CLK_Source_TypeDef clocksource = CLK_SOURCE_HSI;
  uint8_t tmp = 0, presc = 0;

  /* Get CLK source. */
  clocksource = (CLK_Source_TypeDef)CLK->CMSR;

  if (clocksource == CLK_SOURCE_HSI)
  {
    tmp = (uint8_t)(CLK->CKDIVR & CLK_CKDIVR_HSIDIV);
    tmp = (uint8_t)(tmp >> 3);
    presc = HSIDivFactor[tmp];
    clockfrequency = HSI_VALUE / presc;
  }
  else if ( clocksource == CLK_SOURCE_LSI)
  {
    clockfrequency = LSI_VALUE;
  }
  else
  {
    clockfrequency = HSE_VALUE;
  }

  return((uint32_t)clockfrequency);
}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..