Skip to main content

Posts

Showing posts with the label STM32CubeMX

A Simple STM32 Example Project

Most of the embedded projects share certain initial steps. You need to confirm the clock settings before doing anything, then you want to have debug connection via a UART channel since it is cheap  but still it can provide useful information for debugging. Let us start with CubeMX. You select a device/board of your choice, set up the pinouts for one GPIO output and one UART port. Configure the clock if necessary then create a project. Clock Checking using SysTick The sanity of the clock setting can be done by checking the SysTick interval. All Cortex-M series core have SysTick timer by default, which should fire at 1msec interval while the MCU is active. In the STM32Cube, the SysTick is initialized by HAL_Init() call, which in turn calls SysTick_Config() in CMSIS. Once the SysTick is initialized, it generates 1 msec interrupt and this interrupt is handled by SysTick_Handler() according to the Cube framework. Source file 1 /** 2 * @brief This function han...

Makefile Based STM32 Development Environment

The development environment discussed here is minimal, terminal based, and cross platform. This configuration assumes that a terminal based text editor such as vim  and the  make utility are the primary tools for programming. It consists of following components: GNU ARM Embedded Toolchain Makefile Utility STM32CubeMX Flash Tool (JLink or OpenOCD) Hardware The most recent version of the compiler suite can be found  here . The toolchain is self-sufficient. Thus you can simply unzip the archive into any directory of choice then you are good to go. In Linux, make  utility is included in a package such as  build-essential . If you have C/C++ compiler installed on your system then you already have it. In Windows, preferred way to get the utility is to install cygwin first, then to install make from there. Alternatively, you can use the one comes with MinGW system or you can find one of the precompiled version . However you may need to choose 32bi...