AnsweredAssumed Answered

Low Layer Library, first impressions

Question asked by waclawek.jan on Sep 18, 2015
Latest reply on Jun 27, 2016 by waclawek.jan
As announced by Jasmine in https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=57714&RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex%5fmx%5fstm32%2fHAL%20gpio%20libary%20code%20bug&Source=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex%5Fmx%5Fstm32%2FFlat%2Easpx%3FRootFolder%3D%252fpublic%252fSTe2ecommunities%252fmcu%252fLists%252fcortex%255fmx%255fstm32%252fHAL%2520gpio%2520libary%2520code%2520bug%26FolderCTID%3D0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B%26TopicsView%3Dhttps%253A%252F%252Fmy%252Est%252Ecom%252Fpublic%252FSTe2ecommunities%252Fmcu%252FLists%252Fcortex%255Fmx%255Fstm32%252FAllItems%252Easpx , the Low Layer ehm API is available in the current 'L4xx Cube
http://www.st.com/web/en/catalog/tools/PF261908 - and it's not even "next week"! :-)

A whopping 200MB zip, for those who are curious; although the LL-related content is one order of magnitude less (and the vast majority of it are the examples).

For real content, look into
STM32Cube_FW_L4_V1.1.0\Drivers\STM32L4xx_HAL_Driver\Inc\, filenames of the stm32l4xx_ll_XXX.h style (i.e. containing "ll"); there are two more files in ..\Src, too.

Documentation - portions of both STM32Cube_FW_L4_V1.1.0\Documentation\STM32CubeL4GettingStarted.pdf and the doxygen-autovomited STM32Cube_FW_L4_V1.1.0\Drivers\STM32L4xx_HAL_Driver\STM32L486xx_User_Manual.chm - does not depart from the style and quality of the rest of Cube. Examples in STM32Cube_FW_L4_V1.1.0\Projects\STM32L476RG-Nucleo\Examples_LL\. .

An excerpt from the "blinkey" example, to get the feeling of it (doxygen-style comment/headers omitted):
int main(void)
{
  /* Configure the system clock to 80 MHz */
  SystemClock_Config();
   
  /* -2- Configure IO in output push-pull mode to drive external LED */
  Configure_GPIO();
 
  /* Toggle IO in an infinite loop */
  while (1)
  {
    LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
     
    /* Insert delay 250 ms */
    LL_mDelay(250);
  }
}
 
 
__STATIC_INLINE void Configure_GPIO(void)
{
  /* Enable the LED2 Clock */
  LED2_GPIO_CLK_ENABLE();
 
  /* Configure IO in output push-pull mode to drive external LED2 */
  LL_GPIO_SetPinMode(LED2_GPIO_PORT, LED2_PIN, LL_GPIO_MODE_OUTPUT);
  LL_GPIO_SetPinOutputType(LED2_GPIO_PORT, LED2_PIN, LL_GPIO_OUTPUT_PUSHPULL);
  LL_GPIO_SetPinSpeed(LED2_GPIO_PORT, LED2_PIN, LL_GPIO_SPEED_LOW);
  LL_GPIO_SetPinPull(LED2_GPIO_PORT, LED2_PIN, LL_GPIO_PULL_NO);
}
 
__STATIC_INLINE void SystemClock_Config(void)
{
  /* MSI configuration and activation */
  LL_FLASH_SetLatency(LL_FLASH_LATENCY_4);
  LL_RCC_MSI_Enable();
  while(LL_RCC_MSI_IsReady() != 1)
  {
  };
   
  /* Main PLL configuration and activation */
  LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2);
  LL_RCC_PLL_Enable();
  LL_RCC_PLL_EnableDomain_SYS();
  while(LL_RCC_PLL_IsReady() != 1)
  {
  };
   
  /* Sysclk activation on the main PLL */
  LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
  LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
  while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
  {
  };
   
  /* Set APB1 & APB2 prescaler*/
  LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
  LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
 
  /* Set systick to 1ms in using frequency set to 80MHz */
  /* This frequency can be calculated through LL RCC macro */
  /* ex: __LL_RCC_CALC_PLLCLK_FREQ(__LL_RCC_CALC_MSI_FREQ(LL_RCC_MSIRANGESEL_RUN, LL_RCC_MSIRANGE_6),
                                  LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2)*/
  LL_Init1msTick(80000000);
   
  /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
  LL_SetSystemCoreClock(80000000);
}



Correct me if I am wrong, but it's essentially a bunch of macros/static inline functions, barely doing anything else than renaming simple register accesses.

Now I completely fail to understand the reason to do that, so there must be something wrong with me.

JW

Outcomes