Electrical – STM32L4 Clocks Configuration

clockembeddedstm32

Does anyone know of a code template to properly configure clocks, PLL, latency, etc. for the STM32L4x parts? I'm using a NUCLEO board with this part (L476RG) and have struggled for days with the datasheet in vain to learn how to set up the clocks before even beginning to write a "blinky" program to toggle a port pin.

I know of ST's CubeMX program but I'm using the MikroElectronika mikroC compiler (for which CubeMX doesn't produce native output). Tried that and failed too. Anyone have a clue how I might get traction here?

Best Answer

Download the STM32CubeL4 package, which includes example projects for your board and others. The example projects will include code for setting up the clock and PLL. There are pre-made projects for IAR EWARM, MDK-ARM, Atollic TrueStudio but you'll have to create your own project and port for MikroElectronika mikroC.

The STM32Cube example projects use ST's HAL and/or Low-Level (LL) libraries. The library source code is included so even if you don't want to use the libraries in your application then you can still refer to the library source code as an example.

Related Topic